X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/15b104f4ff4614aa78c01180b6a9b89dd5a1400f..d056315710feeea5b0ab022c6abb37764f862422:/test/lib/locale_test.rb?ds=inline diff --git a/test/lib/locale_test.rb b/test/lib/locale_test.rb index 65c7ea398..9aec035d1 100644 --- a/test/lib/locale_test.rb +++ b/test/lib/locale_test.rb @@ -68,7 +68,7 @@ class LocaleTest < ActiveSupport::TestCase end def test_list - assert_equal [], Locale.list + assert_empty Locale.list assert_equal [EN], Locale.list("en") assert_equal [EN, ZH_YUE, ZH_HANT_TW], Locale.list("en", "zh-yue", "zh-Hant-TW") assert_equal [ZH_YUE, ZH_HANT_TW], Locale.list("en;de", "zh-yue", "zh-Hant-TW") @@ -80,7 +80,7 @@ class LocaleTest < ActiveSupport::TestCase end def test_available - assert_equal I18n.available_locales.count, Locale.available.count + assert_operator Locale.available.count, :<=, I18n.available_locales.count end def test_preferred @@ -91,9 +91,12 @@ class LocaleTest < ActiveSupport::TestCase assert_equal "de", Locale.available.preferred(Locale.list("zh-Hant", "de")).to_s assert_equal "zh-TW", Locale.available.preferred(Locale.list("zh-Hant-TW", "de")).to_s assert_equal "zh-TW", Locale.available.preferred(Locale.list("zh-TW", "de")).to_s - assert_equal "zh-HK", Locale.available.preferred(Locale.list("yue", "zh-HK", "de")).to_s - assert_equal "zh-yue", Locale.available. preferred(Locale.list("yue", "zh-yue", "zh-HK", "de")).to_s - assert_equal "zh-yue", Locale.available. preferred(Locale.list("yue", "zh-YUE", "zh-HK", "de")).to_s + assert_equal "zh-HK", Locale.available.preferred( + Locale.list("zh-HK", "zh-hk", "zh-Hant", "zh-hant", "zh-TW", "zh-tw", "zh", "zh-yue", + "yue", "yue-Hant", "yue-HK", "yue-Hans", "zh-classical", "lzh", "ja-Hani", + "ko-Hani", "ko_hanja", "vi-Hani", "ja-hani", "ko-hani", "vi-hani", "en-HK", + "en-hk", "en-SG", "en-sg", "en-GB", "en-gb", "en-US", "en-us", "en", "ja") + ).to_s assert_equal "en", Locale.available.preferred(Locale.list("yue")).to_s end end