From: Niki Roo Date: Wed, 24 Apr 2019 19:41:36 +0000 (+0200) Subject: more tests X-Git-Tag: fanfix-swing-0.0.1~21^2~128 X-Git-Url: https://git.nikiroo.be/?a=commitdiff_plain;h=dd3034f78a3492ee114b6c78d0fbc468544f8343;p=fanfix-swing.git more tests --- diff --git a/src/be/nikiroo/utils/test_code/NextableInputStreamTest.java b/src/be/nikiroo/utils/test_code/NextableInputStreamTest.java index b5f67803..87d64ac2 100644 --- a/src/be/nikiroo/utils/test_code/NextableInputStreamTest.java +++ b/src/be/nikiroo/utils/test_code/NextableInputStreamTest.java @@ -71,8 +71,24 @@ public class NextableInputStreamTest extends TestLauncher { assertEquals("The subIn still has some data", false, subIn12.next()); - - checkNext(this, true, "MAIN LAST", in4, new byte[] { 127, 12, 5 }); + + checkNext(this, true, "MAIN LAST", in4, + new byte[] { 127, 12, 5 }); + } + }); + + addTest(new TestCase("UTF-8 text lines test") { + @Override + public void test() throws Exception { + String ln1 = "Ligne première"; + String ln2 = "Ligne la deuxième du nom"; + byte[] data = (ln1 + "\n" + ln2).getBytes("UTF-8"); + NextableInputStream in = new NextableInputStream( + new ByteArrayInputStream(data), + new NextableInputStreamStep('\n')); + + checkNext(this, false, "FIRST", in, ln1.getBytes("UTF-8")); + checkNext(this, true, "SECOND", in, ln2.getBytes("UTF-8")); } }); }