diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-10-29 05:44:33 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-10-29 05:44:33 +0000 |
commit | ef276e959ec8a8ad0b7683176e2943058335f55c (patch) | |
tree | 1ceb41f82080f9a49fa59b95c9904dff235c1429 /test | |
parent | 5de3e7e2bdce598dfc7348fbe3ef8ee951058d1d (diff) | |
download | ruby-ef276e959ec8a8ad0b7683176e2943058335f55c.tar.gz |
load.c: transcode path
* load.c (rb_f_load): path name needs to be transcoded to OS path
encoding. [ruby-list:49994]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48186 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_require.rb | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/ruby/test_require.rb b/test/ruby/test_require.rb index 5b299f4228..971140afff 100644 --- a/test/ruby/test_require.rb +++ b/test/ruby/test_require.rb @@ -308,6 +308,28 @@ class TestRequire < Test::Unit::TestCase } end + def test_load_ospath + bug = '[ruby-list:49994] path in ospath' + base = "test_load\u{3042 3044 3046 3048 304a}".encode(Encoding::Windows_31J) + path = nil + Tempfile.create([base, ".rb"]) do |t| + path = t.path + + assert_raise_with_message(LoadError, /#{base}/) { + load(File.join(File.dirname(path), base)) + } + + t.puts "warn 'ok'" + t.close + assert_include(path, base) + assert_warn("ok\n", bug) { + assert_nothing_raised(LoadError, bug) { + load(path) + } + } + end + end + def test_tainted_loadpath Tempfile.create(["test_ruby_test_require", ".rb"]) {|t| abs_dir, file = File.split(t.path) |