|
1 | 1 | package cucumber.runtime;
|
2 | 2 |
|
| 3 | +import net.sourceforge.cobertura.ant.Regex; |
| 4 | + |
3 | 5 | import org.junit.Test;
|
4 | 6 |
|
5 | 7 | import java.io.File;
|
@@ -71,7 +73,37 @@ public void name() {
|
71 | 73 | Pattern actualPattern = (Pattern) options.filters.iterator().next();
|
72 | 74 | assertEquals(someName, actualPattern.pattern());
|
73 | 75 | }
|
74 |
| - |
| 76 | + |
| 77 | + @Test |
| 78 | + public void name_with_spaces() { |
| 79 | + String someName = "some Name"; |
| 80 | + RuntimeOptions options = new RuntimeOptions(new Properties(), "--name", someName); |
| 81 | + Pattern actualPattern = (Pattern) options.filters.iterator().next(); |
| 82 | + assertEquals(someName, actualPattern.pattern()); |
| 83 | + } |
| 84 | + |
| 85 | + @Test |
| 86 | + public void ensure_name_with_spaces_works_with_cucumber_options() { |
| 87 | + String someName = "some Name"; |
| 88 | + Properties properties = new Properties(); |
| 89 | + properties.setProperty("cucumber.options", "--name '" + someName + "'"); |
| 90 | + RuntimeOptions options = new RuntimeOptions(properties); |
| 91 | + Pattern actualPattern = (Pattern) options.filters.iterator().next(); |
| 92 | + assertEquals(someName, actualPattern.pattern()); |
| 93 | + } |
| 94 | + |
| 95 | + @Test |
| 96 | + public void ensure_multiple_cucumber_options_with_spaces_parse_correctly() { |
| 97 | + String someName = "some Name"; |
| 98 | + String somePath = "some file\\path"; |
| 99 | + Properties properties = new Properties(); |
| 100 | + properties.setProperty("cucumber.options", "--name '" + someName + "'" + " --dotcucumber '" + somePath + "'"); |
| 101 | + RuntimeOptions options = new RuntimeOptions(properties); |
| 102 | + Pattern actualPattern = (Pattern) options.filters.iterator().next(); |
| 103 | + assertEquals(someName, actualPattern.pattern()); |
| 104 | + assertEquals(new File(somePath), options.dotCucumber); |
| 105 | + } |
| 106 | + |
75 | 107 | @Test
|
76 | 108 | public void name_short() {
|
77 | 109 | String someName = "someName";
|
|
0 commit comments