File tree Expand file tree Collapse file tree 1 file changed +36
-0
lines changed
yaml/src/test/java/tools/jackson/dataformat/yaml/tofix Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change 1+ package tools .jackson .dataformat .yaml .tofix ;
2+
3+ import java .io .StringWriter ;
4+
5+ import org .junit .jupiter .api .Test ;
6+
7+ import tools .jackson .core .*;
8+
9+ import tools .jackson .dataformat .yaml .ModuleTestBase ;
10+ import tools .jackson .dataformat .yaml .YAMLFactory ;
11+ import tools .jackson .dataformat .yaml .YAMLMapper ;
12+ import tools .jackson .dataformat .yaml .YAMLWriteFeature ;
13+ import tools .jackson .dataformat .yaml .testutil .failure .JacksonTestFailureExpected ;
14+
15+ import static org .junit .jupiter .api .Assertions .*;
16+
17+ public class GeneratorWithMinimize568Test extends ModuleTestBase
18+ {
19+ private final YAMLMapper MINIM_MAPPER = new YAMLMapper (YAMLFactory .builder ()
20+ .enable (YAMLWriteFeature .MINIMIZE_QUOTES )
21+ .build ());
22+
23+ // [dataformats-text#568]: snakeyaml-engine bug fixed in 3.x
24+ @ JacksonTestFailureExpected
25+ @ Test
26+ void testLinefeedAsDoc () {
27+ StringWriter writer = new StringWriter ();
28+ try (JsonGenerator generator = MINIM_MAPPER .createGenerator (writer )) {
29+ generator .writeString ("\n " );
30+ }
31+ try (JsonParser parser = MINIM_MAPPER .createParser (writer .toString ())) {
32+ assertToken (JsonToken .VALUE_STRING , parser .nextToken ()); // fails!
33+ assertEquals ("\n " , parser .getString ());
34+ }
35+ }
36+ }
You can’t perform that action at this time.
0 commit comments