]> granicus.if.org Git - icu/commitdiff
ICU-8070 Check that the rule parser handles a comment without terminating end-of...
authorMarkus Scherer <markus.icu@gmail.com>
Thu, 27 Feb 2014 22:52:07 +0000 (22:52 +0000)
committerMarkus Scherer <markus.icu@gmail.com>
Thu, 27 Feb 2014 22:52:07 +0000 (22:52 +0000)
X-SVN-Rev: 35257

icu4c/source/test/intltest/regcoll.cpp
icu4c/source/test/intltest/regcoll.h

index f9c0ef1489c5b731d1bd1b0ad88029d3492332cb..1f732aea8077f9e0644da66f55bdf0d3bf9b72e4 100644 (file)
@@ -1307,7 +1307,15 @@ void CollationRegressionTest::caseFirstCompressionSub(Collator *col, UnicodeStri
     }
 }
 
-
+void CollationRegressionTest::TestTrailingComment() {
+    // ICU ticket #8070:
+    // Check that the rule parser handles a comment without terminating end-of-line.
+    IcuTestErrorCode errorCode(*this, "TestTrailingComment");
+    RuleBasedCollator coll(UNICODE_STRING_SIMPLE("&c<b#comment1\n<a#comment2"), errorCode);
+    UnicodeString a((UChar)0x61), b((UChar)0x62), c((UChar)0x63);
+    assertTrue("c<b", coll.compare(c, b) < 0);
+    assertTrue("b<a", coll.compare(b, a) < 0);
+}
 
 void CollationRegressionTest::compareArray(Collator &c,
                                            const UChar tests[][CollationRegressionTest::MAX_TOKEN_LEN],
@@ -1446,6 +1454,7 @@ void CollationRegressionTest::runIndexedTest(int32_t index, UBool exec, const ch
     TESTCASE_AUTO(Test4179216);
     TESTCASE_AUTO(TestT7189);
     TESTCASE_AUTO(TestCaseFirstCompression);
+    TESTCASE_AUTO(TestTrailingComment);
     TESTCASE_AUTO_END;
 }
 
index 4048d6fcb65e4167582ce2b440f4e38615bf35bb..91b2a90dcbb2ef3dbc264a27926841585448d586 100644 (file)
@@ -238,6 +238,8 @@ public:
     //
     void TestCaseFirstCompression();
 
+    void TestTrailingComment();
+
 private:
     //------------------------------------------------------------------------
     // Internal utilities