diff options
author | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-01-21 15:38:57 +0000 |
---|---|---|
committer | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-01-21 15:38:57 +0000 |
commit | 8715551b9c187f86e16764a6de1af62763eb37f0 (patch) | |
tree | 60548fc37c3aa07bee652645195ccf12faa4acb9 /test | |
parent | 12ef4f02289dfada188581578d6388d06654c0c5 (diff) |
merge revision(s) r48186: [Backport #10448]
* 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/branches/ruby_2_1@49366 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 3bd327c851..2bdad8f981 100644 --- a/test/ruby/test_require.rb +++ b/test/ruby/test_require.rb @@ -307,6 +307,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) |