aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_require.rb14
1 files changed, 12 insertions, 2 deletions
diff --git a/test/ruby/test_require.rb b/test/ruby/test_require.rb
index 26d7d74d96..42479e7518 100644
--- a/test/ruby/test_require.rb
+++ b/test/ruby/test_require.rb
@@ -75,6 +75,17 @@ class TestRequire < Test::Unit::TestCase
assert_require_nonascii_path(encoding, bug8676)
end
+ case RUBY_PLATFORM
+ when /cygwin/, /mswin/, /mingw/
+ def self.ospath_encoding(path)
+ Encoding::UTF_8
+ end
+ else
+ def self.ospath_encoding(path)
+ path.encoding
+ end
+ end
+
def assert_require_nonascii_path(encoding, bug)
Dir.mktmpdir {|tmp|
dir = "\u3042" * 5
@@ -94,8 +105,7 @@ class TestRequire < Test::Unit::TestCase
$:.clear
assert_nothing_raised(LoadError, bug) {
assert(require(require_path), bug)
- assert_equal(Encoding.find(encoding), $".last.encoding)
- assert_equal(Encoding.find(encoding), $:.last.encoding, '[Bug #8753]')
+ assert_equal(self.class.ospath_encoding(require_path), $:.last.encoding, '[Bug #8753]')
assert(!require(require_path), bug)
}
ensure