Skip to content

Commit ed6c536

Browse files
authored
add csv tests where the 3 byte char is 2nd last (#544)
1 parent e3c08c6 commit ed6c536

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

csv/src/test/java/com/fasterxml/jackson/dataformat/csv/tofix/UnicodeCSVRead497Test.java

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,18 @@ public void testUnicodeAtEnd() throws Exception
3131
assertEquals(o.get(0).textValue(), doc);
3232
}
3333

34+
@Test
35+
public void testUnicodeAtEnd2() throws Exception
36+
{
37+
String doc = buildTestString2();
38+
JsonNode o = MAPPER.reader() //.with(schema)
39+
.readTree(doc.getBytes(StandardCharsets.UTF_8));
40+
assertNotNull(o);
41+
assertTrue(o.isArray());
42+
assertEquals(1, o.size());
43+
assertEquals(o.get(0).textValue(), doc);
44+
}
45+
3446
@Test
3547
public void testUnicodeAtEndStream() throws Exception
3648
{
@@ -43,6 +55,18 @@ public void testUnicodeAtEndStream() throws Exception
4355
assertEquals(o.get(0).textValue(), doc);
4456
}
4557

58+
@Test
59+
public void testUnicodeAtEndStream2() throws Exception
60+
{
61+
String doc = buildTestString2();
62+
JsonNode o = MAPPER.reader() //.with(schema)
63+
.readTree(new ByteArrayInputStream(doc.getBytes(StandardCharsets.UTF_8)));
64+
assertNotNull(o);
65+
assertTrue(o.isArray());
66+
assertEquals(1, o.size());
67+
assertEquals(o.get(0).textValue(), doc);
68+
}
69+
4670
private static String buildTestString() {
4771
StringBuilder sb = new StringBuilder(4001);
4872
for (int i = 0; i < 4000; ++i) {
@@ -51,4 +75,14 @@ private static String buildTestString() {
5175
sb.append('\u5496');
5276
return sb.toString();
5377
}
78+
79+
private static String buildTestString2() {
80+
StringBuilder sb = new StringBuilder(4001);
81+
for (int i = 0; i < 3999; ++i) {
82+
sb.append('a');
83+
}
84+
sb.append('\u5496');
85+
sb.append('b');
86+
return sb.toString();
87+
}
5488
}

0 commit comments

Comments
 (0)