From dd3034f78a3492ee114b6c78d0fbc468544f8343 Mon Sep 17 00:00:00 2001 From: Niki Roo Date: Wed, 24 Apr 2019 21:41:36 +0200 Subject: [PATCH] more tests --- .../test_code/NextableInputStreamTest.java | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) 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")); } }); } -- 2.27.0