diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_env.rb | 19 | ||||
-rw-r--r-- | test/ruby/test_m17n.rb | 10 |
2 files changed, 16 insertions, 13 deletions
diff --git a/test/ruby/test_env.rb b/test/ruby/test_env.rb index 7735b53045..ddfce136a4 100644 --- a/test/ruby/test_env.rb +++ b/test/ruby/test_env.rb @@ -369,7 +369,8 @@ class TestEnv < Test::Unit::TestCase assert_equal("foo", v) end assert_invalid_env {|var| ENV.assoc(var)} - assert_equal(Encoding.find("locale"), v.encoding) + encoding = /mswin|mingw/ =~ RUBY_PLATFORM ? Encoding::UTF_8 : Encoding.find("locale") + assert_equal(encoding, v.encoding) end def test_has_value2 @@ -579,15 +580,13 @@ class TestEnv < Test::Unit::TestCase end; end - if Encoding.find("locale") == Encoding::UTF_8 - def test_utf8 - text = "testing \u{e5 e1 e2 e4 e3 101 3042}" - test = ENV["test"] - ENV["test"] = text - assert_equal text, ENV["test"] - ensure - ENV["test"] = test - end + def test_utf8 + text = "testing \u{e5 e1 e2 e4 e3 101 3042}" + test = ENV["test"] + ENV["test"] = text + assert_equal text, ENV["test"] + ensure + ENV["test"] = test end end end diff --git a/test/ruby/test_m17n.rb b/test/ruby/test_m17n.rb index 2c6dc3f8f5..3f28d55ac1 100644 --- a/test/ruby/test_m17n.rb +++ b/test/ruby/test_m17n.rb @@ -1325,10 +1325,14 @@ class TestM17N < Test::Unit::TestCase end def test_env - locale_encoding = Encoding.find("locale") + if RUBY_PLATFORM =~ /bccwin|mswin|mingw/ + env_encoding = Encoding::UTF_8 + else + env_encoding = Encoding.find("locale") + end ENV.each {|k, v| - assert_equal(locale_encoding, k.encoding, k) - assert_equal(locale_encoding, v.encoding, v) + assert_equal(env_encoding, k.encoding, k) + assert_equal(env_encoding, v.encoding, v) } end |