diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-08-11 13:57:29 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-08-11 13:57:29 +0000 |
commit | 7cb53ed363159c26e6fdd40d42b683bc1b5707d1 (patch) | |
tree | a9c9ead771f8ac20bdf8f5a4e4dfc1e4453a2909 /test | |
parent | bd2b8d260301c6886d1a51a84c85d2866457be1f (diff) | |
download | ruby-7cb53ed363159c26e6fdd40d42b683bc1b5707d1.tar.gz |
test_require.rb: __FILE__ encoding on Windows
* test/ruby/test_require.rb (assert_require_nonascii_path): OS path
encoding on Windows is fixed, so encoding of __FILE__ should be it.
[ruby-core:56498] [Bug #8764]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42523 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_require.rb | 14 |
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 |