diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /intl/locale/tests/unit/test_collation_mac_icu.js | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'intl/locale/tests/unit/test_collation_mac_icu.js')
-rw-r--r-- | intl/locale/tests/unit/test_collation_mac_icu.js | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/intl/locale/tests/unit/test_collation_mac_icu.js b/intl/locale/tests/unit/test_collation_mac_icu.js new file mode 100644 index 000000000..32ebc60eb --- /dev/null +++ b/intl/locale/tests/unit/test_collation_mac_icu.js @@ -0,0 +1,83 @@ +var {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components; + +Cu.import("resource://gre/modules/Services.jsm"); + +function run_test() +{ + var input = [ + "Argentina", + "Oerlikon", + "Offenbach", + "Sverige", + "Vaticano", + "Zimbabwe", + "la France", + "¡viva España!", + "Österreich", + "中国", + "日本", + "한국", + ]; + + function test(locale, expected) { + var localeSvc = Cc["@mozilla.org/intl/nslocaleservice;1"]. + getService(Ci.nsILocaleService); + var collator = Cc["@mozilla.org/intl/collation-factory;1"]. + createInstance(Ci.nsICollationFactory). + CreateCollation(localeSvc.newLocale(locale)); + var strength = Ci.nsICollation.kCollationStrengthDefault; + var actual = input.sort((x, y) => collator.compareString(strength, x,y)); + deepEqual(actual, expected, locale); + } + + // Locale en-US; default options. + test("en-US", [ + "¡viva España!", + "Argentina", + "la France", + "Oerlikon", + "Offenbach", + "Österreich", + "Sverige", + "Vaticano", + "Zimbabwe", + "한국", + "中国", + "日本", + ]); + + // Locale sv-SE; default options. + // Swedish treats "Ö" as a separate character, which sorts after "Z". + test("sv-SE", [ + "¡viva España!", + "Argentina", + "la France", + "Oerlikon", + "Offenbach", + "Sverige", + "Vaticano", + "Zimbabwe", + "Österreich", + "한국", + "中国", + "日本", + ]); + + // Locale de-DE; default options. + // In German standard sorting, umlauted characters are treated as variants + // of their base characters: ä ≅ a, ö ≅ o, ü ≅ u. + test("de-DE", [ + "¡viva España!", + "Argentina", + "la France", + "Oerlikon", + "Offenbach", + "Österreich", + "Sverige", + "Vaticano", + "Zimbabwe", + "한국", + "中国", + "日本", + ]); +} |