File tree Expand file tree Collapse file tree 2 files changed +31
-1
lines changed
main/java/io/cucumber/core/plugin
test/java/io/cucumber/core/plugin Expand file tree Collapse file tree 2 files changed +31
-1
lines changed Original file line number Diff line number Diff line change @@ -186,7 +186,9 @@ private void printText(WriteEvent event) {
186
186
try (BufferedReader lines = new BufferedReader (new StringReader (event .getText ()))) {
187
187
String line ;
188
188
while ((line = lines .readLine ()) != null ) {
189
- builder .append (String .format (STEP_SCENARIO_INDENT + line + "%n" ));
189
+ builder .append (STEP_SCENARIO_INDENT )
190
+ .append (line )
191
+ .append (System .lineSeparator ()); // Add system line separator - \n won't do it!
190
192
}
191
193
} catch (IOException e ) {
192
194
throw new CucumberException (e );
Original file line number Diff line number Diff line change @@ -165,6 +165,34 @@ void should_handle_scenario_outline() {
165
165
" Then third step # path/step_definitions.java:11\n " ));
166
166
}
167
167
168
+ @ Test
169
+ void should_print_encoded_characters () {
170
+
171
+ Feature feature = TestFeatureParser .parse ("path/test.feature" , "" +
172
+ "Feature: Test feature\n " +
173
+ " Scenario: Test Characters\n " +
174
+ " Given first step\n " +
175
+ " | URLEncoded | %71s%22i%22%3A%7B%22D |\n " );
176
+
177
+ ByteArrayOutputStream out = new ByteArrayOutputStream ();
178
+ Runtime .builder ()
179
+ .withFeatureSupplier (new StubFeatureSupplier (feature ))
180
+ .withAdditionalPlugins (new PrettyFormatter (out ))
181
+ .withRuntimeOptions (new RuntimeOptionsBuilder ().setMonochrome ().build ())
182
+ .withBackendSupplier (new StubBackendSupplier (
183
+ new StubStepDefinition ("first step" , "path/step_definitions.java:7" , DataTable .class )))
184
+ .build ()
185
+ .run ();
186
+
187
+ assertThat (out , isBytesEqualTo ("" +
188
+
189
+ "\n " +
190
+ "Scenario: Test Characters # path/test.feature:2\n " +
191
+ " Given first step # path/step_definitions.java:7\n " +
192
+ " | URLEncoded | %71s%22i%22%3A%7B%22D |\n " ));
193
+ }
194
+
195
+
168
196
@ Test
169
197
void should_print_tags () {
170
198
Feature feature = TestFeatureParser .parse ("path/test.feature" , "" +
You can’t perform that action at this time.
0 commit comments