-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace inheritance with delegation for #138
- Loading branch information
1 parent
9379c6c
commit b34455c
Showing
26 changed files
with
297 additions
and
199 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
clojure/src/main/java/cucumber/runtime/clojure/ClojureSnippet.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package cucumber.runtime.clojure; | ||
|
||
import cucumber.runtime.snippets.Snippet; | ||
|
||
import java.util.List; | ||
|
||
import static cucumber.runtime.snippets.SnippetGenerator.untypedArguments; | ||
|
||
public class ClojureSnippet implements Snippet { | ||
@Override | ||
public String template() { | ||
return "({0} #\"{1}\"\n" + | ||
" (fn [{3}]\n" + | ||
" \" {4}\n" + // TODO: The " should be a ', but that causes a propblem with MessageFormat escaping {4}. Need to read up on MessageFormat docs. | ||
" ))\n"; | ||
} | ||
|
||
@Override | ||
public String arguments(List<Class<?>> argumentTypes) { | ||
return untypedArguments(argumentTypes); | ||
} | ||
|
||
@Override | ||
public String namedGroupStart() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public String namedGroupEnd() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public String escapePattern(String pattern) { | ||
return pattern; | ||
} | ||
} |
25 changes: 0 additions & 25 deletions
25
clojure/src/main/java/cucumber/runtime/clojure/ClojureSnippetGenerator.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package cucumber.runtime.snippets; | ||
|
||
import java.util.List; | ||
|
||
public interface Snippet { | ||
String template(); | ||
|
||
String arguments(List<Class<?>> argumentTypes); | ||
|
||
/** | ||
* Langauges that don't support named capture groups should return null. | ||
* @return the start of a named group | ||
*/ | ||
String namedGroupStart(); | ||
|
||
String namedGroupEnd(); | ||
|
||
String escapePattern(String pattern); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package cucumber.runtime.ioke; | ||
|
||
import cucumber.runtime.snippets.Snippet; | ||
|
||
import java.util.List; | ||
|
||
public class IokeSnippet implements Snippet { | ||
|
||
@Override | ||
public String template() { | ||
return "{0}(#/{1}/,\n" + | ||
" # {4}\n" + | ||
")\n"; | ||
} | ||
|
||
@Override | ||
public String arguments(List<Class<?>> argumentTypes) { | ||
return null; // not used | ||
} | ||
|
||
@Override | ||
public String namedGroupStart() { | ||
return "{arg"; | ||
} | ||
|
||
@Override | ||
public String namedGroupEnd() { | ||
return "}"; | ||
} | ||
|
||
@Override | ||
public String escapePattern(String pattern) { | ||
return pattern; | ||
} | ||
} |
Oops, something went wrong.