From ef276e959ec8a8ad0b7683176e2943058335f55c Mon Sep 17 00:00:00 2001 From: nobu Date: Wed, 29 Oct 2014 05:44:33 +0000 Subject: 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 --- test/ruby/test_require.rb | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'test') 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) -- cgit v1.2.3