test/test_detect_general.rb in locale-2.1.3 vs test/test_detect_general.rb in locale-2.1.4

- old
+ new

@@ -25,17 +25,29 @@ class TestDetectGeneral < Test::Unit::TestCase def setup Locale.init Locale.clear_all + @have_win32_driver = + (Locale::Driver.const_defined?(:Win32) and + Locale::Driver::Win32.respond_to?(:set_thread_locale_id)) + if @have_win32_driver + Locale::Driver::Win32.set_thread_locale_id(0xffff) # invalid + end ENV["LC_ALL"] = nil ENV["LC_CTYPE"] = nil ENV["LC_MESSAGES"] = nil ENV["LANG"] = nil ENV["LANGUAGE"] = nil end + def teardown + if @have_win32_driver + Locale::Driver::Win32.set_thread_locale_id(nil) + end + end + def test_lc_all ENV["LC_ALL"] = "ja_JP.eucJP" ENV["LC_CTYPE"] = "fr_FR.ISO-8859-1" #Ignored. ENV["LC_MESSAGES"] = "zh_CN.UTF-8" #Ignored. ENV["LANG"] = "ko_KR.UTF-8" #Ignored. @@ -163,26 +175,32 @@ assert_equal "Shift_JIS", Locale.charset end test "LC_ALL=C" do + omit("Can't disable the JRuby's default") if jruby? + ENV["LC_ALL"] = "C" ENV["LANGUAGE"] = "zh_CN.UTF-8:ja_JP" # ignored assert_equal([Locale::Tag::Simple.new("en")], Locale.current) end test "LC_MESSAGES=C" do + omit("Can't disable the JRuby's default") if jruby? + ENV["LC_MESSAGES"] = "C" ENV["LANGUAGE"] = "zh_CN.UTF-8:ja_JP" # ignored assert_equal([Locale::Tag::Simple.new("en")], Locale.current) end test "LANG=C" do + omit("Can't disable the JRuby's default") if jruby? + ENV["LANG"] = "C" ENV["LANGUAGE"] = "zh_CN.UTF-8:ja_JP" # ignored assert_equal([Locale::Tag::Simple.new("en")], Locale.current) @@ -211,27 +229,33 @@ ], Locale.current) end test "LC_ALL=C and LC_MESSAGES" do + omit("Can't disable the JRuby's default") if jruby? + ENV["LC_ALL"] = "C" ENV["LC_MESSAGES"] = "ja_JP.Shift_JIS" ENV["LANGUAGE"] = "zh_CN.UTF-8:ja_JP" # ignored assert_equal([Locale::Tag::Simple.new("en")], Locale.current) end test "LC_ALL=C and LANG" do + omit("Can't disable the JRuby's default") if jruby? + ENV["LC_ALL"] = "C" ENV["LANG"] = "ja_JP.Shift_JIS" ENV["LANGUAGE"] = "zh_CN.UTF-8:ja_JP" # ignored assert_equal([Locale::Tag::Simple.new("en")], Locale.current) end test "LC_MESSAGES=C and LANG" do + omit("Can't disable the JRuby's default") if jruby? + ENV["LC_MESSAGES"] = "C" ENV["LANG"] = "ja_JP.Shift_JIS" ENV["LANGUAGE"] = "zh_CN.UTF-8:ja_JP" # ignored assert_equal([Locale::Tag::Simple.new("en")],