Skip to content

Commit 036025f

Browse files
committed
Added plus and period to escaped characters
1 parent 22bf537 commit 036025f

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

core/src/main/java/cucumber/runtime/snippets/SnippetGenerator.java

+2
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ public class SnippetGenerator {
2424
Pattern.compile("\\]"),
2525
Pattern.compile("\\?"),
2626
Pattern.compile("\\*"),
27+
Pattern.compile("\\+"),
28+
Pattern.compile("\\."),
2729
Pattern.compile("\\^"),};
2830

2931
private static final String REGEXP_HINT = "Express the Regexp above with the code you wish you had";

java/src/test/java/cucumber/runtime/java/JavaSnippetTest.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,12 @@ public void generatesSnippetWithEscapedQuestionMarks() {
9090
@Test
9191
public void generatesSnippetWithLotsOfEscapes() {
9292
String expected = "" +
93-
"@Given(\"^\\\\^\\\\(\\\\[a-z\\\\]\\\\*\\\\)\\\\?\\\\$$\")\n" +
93+
"@Given(\"^\\\\^\\\\(\\\\[a-z\\\\]\\\\*\\\\)\\\\?\\\\.\\\\+\\\\$$\")\n" +
9494
"public void _a_z_$() throws Throwable {\n" +
9595
" // Express the Regexp above with the code you wish you had\n" +
9696
" throw new PendingException();\n" +
9797
"}\n";
98-
assertEquals(expected, snippetFor("^([a-z]*)?$"));
98+
assertEquals(expected, snippetFor("^([a-z]*)?.+$"));
9999
}
100100

101101
@Test

0 commit comments

Comments
 (0)