1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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
This commit is contained in:
nobu 2013-08-11 13:57:29 +00:00
parent bd2b8d2603
commit 7cb53ed363
2 changed files with 18 additions and 2 deletions

View file

@ -1,3 +1,9 @@
Sun Aug 11 22:57:24 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
* 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]
Sun Aug 11 19:11:45 2013 Kouhei Sutou <kou@cozmixng.org>
* test/rexml/parser/test_sax2.rb: Expand abbreviated class name.

View file

@ -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