X-Git-Url: https://git.saurik.com/apple/icu.git/blobdiff_plain/efa1e6592fb03ce23b15276b2b91d885a3ee7da5..57a6839dcb3bba09e8228b822b290604668416fe:/icuSources/test/intltest/listformattertest.cpp diff --git a/icuSources/test/intltest/listformattertest.cpp b/icuSources/test/intltest/listformattertest.cpp index 07c1c560..1e041836 100644 --- a/icuSources/test/intltest/listformattertest.cpp +++ b/icuSources/test/intltest/listformattertest.cpp @@ -1,7 +1,7 @@ /* ******************************************************************************* * -* Copyright (C) 2012-2013, International Business Machines +* Copyright (C) 2012-2014, International Business Machines * Corporation and others. All Rights Reserved. * ******************************************************************************* @@ -110,6 +110,30 @@ void ListFormatterTest::TestEnglish() { CheckFourCases("en", one, two, three, four, results); } +void ListFormatterTest::Test9946() { + UErrorCode errorCode = U_ZERO_ERROR; + LocalPointer formatter(ListFormatter::createInstance(Locale("en"), errorCode)); + if (U_FAILURE(errorCode)) { + dataerrln( + "ListFormatter::createInstance(Locale(\"en\"), errorCode) failed in Test9946: %s", + u_errorName(errorCode)); + return; + } + UnicodeString data[3] = {"{0}", "{1}", "{2}"}; + UnicodeString actualResult; + formatter->format(data, 3, actualResult, errorCode); + if (U_FAILURE(errorCode)) { + dataerrln( + "ListFormatter::createInstance(Locale(\"en\"), errorCode) failed in Test9946: %s", + u_errorName(errorCode)); + return; + } + UnicodeString expected("{0}, {1}, and {2}"); + if (expected != actualResult) { + errln("Expected " + expected + ", got " + actualResult); + } +} + void ListFormatterTest::TestEnglishUS() { UnicodeString results[4] = { one, @@ -201,6 +225,7 @@ void ListFormatterTest::runIndexedTest(int32_t index, UBool exec, case 5: name = "TestMalayalam"; if (exec) TestMalayalam(); break; case 6: name = "TestZulu"; if (exec) TestZulu(); break; case 7: name = "TestOutOfOrderPatterns"; if (exec) TestOutOfOrderPatterns(); break; + case 8: name = "Test9946"; if (exec) Test9946(); break; default: name = ""; break; }