Skip to content

Commit 6bdab48

Browse files
authored
Add failing test for #568 (#592)
1 parent 984c6e4 commit 6bdab48

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
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+
}

0 commit comments

Comments
 (0)