X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/cb87f02642d0097ebc067ca1f9371dde274a41e3..af6fec502ac22d68224ec80bc925781955b0e842:/test/lib/locale_test.rb?ds=sidebyside diff --git a/test/lib/locale_test.rb b/test/lib/locale_test.rb index 65c7ea398..d84239038 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 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