From 586c9bd962f0c3f9aa520d7f2f9bf0f7447a9cbf Mon Sep 17 00:00:00 2001 From: Tsuda Kageyu <tsuda.kageyu@gmail.com> Date: Thu, 26 Jan 2017 17:33:54 +0900 Subject: [PATCH] Add a test for unpaired surrogate characters in a UTF-16 string. --- tests/test_string.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/test_string.cpp b/tests/test_string.cpp index 4e3a1ac5..d3661c24 100644 --- a/tests/test_string.cpp +++ b/tests/test_string.cpp @@ -176,6 +176,10 @@ public: const String s2(v2, String::UTF8); CPPUNIT_ASSERT_EQUAL(s2.data(String::UTF16), v1); + + const ByteVector v3("\xff\xfe\xb7\xdf\xce\x91\x4b\x5c"); + const String s3(v2, String::UTF16); + CPPUNIT_ASSERT(s3.isEmpty()); } void testAppendStringDetach() -- 2.40.0