add unit test for [JACKSON-779]
diff --git a/src/test/org/codehaus/jackson/main/TestComments.java b/src/test/org/codehaus/jackson/main/TestComments.java
index 564cf6b..425f8c2 100644
--- a/src/test/org/codehaus/jackson/main/TestComments.java
+++ b/src/test/org/codehaus/jackson/main/TestComments.java
@@ -8,8 +8,7 @@
* Unit tests for verifying that support for (non-standard) comments
* works as expected.
*/
-public class TestComments
- extends main.BaseTest
+public class TestComments extends main.BaseTest
{
final static String DOC_WITH_SLASHSTAR_COMMENT =
"[ /* comment:\n ends here */ 1 /* one more ok to have \"unquoted\" */ ]"
@@ -19,6 +18,12 @@
"[ // comment...\n 1 \r // one more, not array: [] \n ]"
;
+ /*
+ /**********************************************************
+ /* Test method wrappers
+ /**********************************************************
+ */
+
/**
* Unit test for verifying that by default comments are not
* recognized.
@@ -50,14 +55,31 @@
_testEnabled(DOC_WITH_SLASHSLASH_COMMENT, true);
}
+ // for [JACKSON-779]
+ public void testCommentsWithUTF8() throws Exception
+ {
+ final String JSON = "/* \u00a9 2099 Yoyodyne Inc. */\n [ \"bar? \u00a9\" ]\n";
+ _testWithUTF8Chars(JSON, false);
+ _testWithUTF8Chars(JSON, true);
+ }
+
/*
- /////////////////////////////////////////////////
- // Helper methods
- /////////////////////////////////////////////////
+ /**********************************************************
+ /* Helper methods
+ /**********************************************************
*/
- private void _testDisabled(String doc, boolean useStream)
- throws IOException
+ private void _testWithUTF8Chars(String doc, boolean useStream) throws IOException
+ {
+ // should basically just stream through
+ JsonParser jp = _createParser(doc, useStream, true);
+ assertToken(JsonToken.VALUE_STRING, jp.nextToken());
+ assertToken(JsonToken.END_ARRAY, jp.nextToken());
+ assertNull(jp.nextToken());
+ jp.close();
+ }
+
+ private void _testDisabled(String doc, boolean useStream) throws IOException
{
JsonParser jp = _createParser(doc, useStream, false);
try {