+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
*
*
*******************************************************************************
* file name: listformattertest.cpp
-* encoding: US-ASCII
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
CheckFourCases("en_US", one, two, three, four, results);
}
+// Tests resource loading and inheritance when region sublocale
+// has only partial data for the listPattern element (overriding
+// some of the parent data). #12994
+void ListFormatterTest::TestEnglishGB() {
+ UnicodeString results[4] = {
+ one,
+ one + " and " + two,
+ one + ", " + two + " and " + three,
+ one + ", " + two + ", " + three + " and " + four
+ };
+
+ CheckFourCases("en_GB", one, two, three, four, results);
+}
+
+// Tests resource loading and inheritance when region sublocale
+// has only partial data for the listPattern element (overriding
+// some of the parent data). #12994
+void ListFormatterTest::TestNynorsk() {
+ UnicodeString results[4] = {
+ one,
+ one + " og " + two,
+ one + ", " + two + " og " + three,
+ one + ", " + two + ", " + three + " og " + four
+ };
+
+ CheckFourCases("nn", one, two, three, four, results);
+}
+
+// Tests resource loading and inheritance when region sublocale
+// has only partial data for the listPattern element (overriding
+// some of the parent data). #12994
+void ListFormatterTest::TestChineseTradHK() {
+ UnicodeString and_string = UnicodeString("\\u53CA", -1, US_INV).unescape();
+ UnicodeString comma_string = UnicodeString("\\u3001", -1, US_INV).unescape();
+ UnicodeString results[4] = {
+ one,
+ one + and_string + two,
+ one + comma_string + two + and_string + three,
+ one + comma_string + two + comma_string + three + and_string + four
+ };
+
+ CheckFourCases("zh_Hant_HK", one, two, three, four, results);
+}
+
// Formatting in Russian.
// "\\u0438" is used before the last element, and all elements up to (but not including) the penultimate are followed by a comma.
void ListFormatterTest::TestRussian() {
void ListFormatterTest::TestZulu() {
UnicodeString results[4] = {
one,
- "I-" + one + " ne-" + two,
+ one + " ne-" + two,
one + ", " + two + ", ne-" + three,
one + ", " + two + ", " + three + ", ne-" + four
};
case 6: name = "TestZulu"; if (exec) TestZulu(); break;
case 7: name = "TestOutOfOrderPatterns"; if (exec) TestOutOfOrderPatterns(); break;
case 8: name = "Test9946"; if (exec) Test9946(); break;
+ case 9: name = "TestEnglishGB"; if (exec) TestEnglishGB(); break;
+ case 10: name = "TestNynorsk"; if (exec) TestNynorsk(); break;
+ case 11: name = "TestChineseTradHK"; if (exec) TestChineseTradHK(); break;
default: name = ""; break;
}