summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_exception.rb2
-rw-r--r--test/ruby/test_require.rb14
2 files changed, 15 insertions, 1 deletions
diff --git a/test/ruby/test_exception.rb b/test/ruby/test_exception.rb
index 6955118de7..bcad728789 100644
--- a/test/ruby/test_exception.rb
+++ b/test/ruby/test_exception.rb
@@ -1019,7 +1019,7 @@ $stderr = $stdout; raise "\x82\xa0"') do |outs, errs, status|
warning = nil
path = nil
Tempfile.create(%w[circular .rb]) do |t|
- path = t.path
+ path = File.realpath(t.path)
basename = File.basename(path)
t.puts "require '#{basename}'"
t.close
diff --git a/test/ruby/test_require.rb b/test/ruby/test_require.rb
index 1bed6c4f64..28cf686a26 100644
--- a/test/ruby/test_require.rb
+++ b/test/ruby/test_require.rb
@@ -881,4 +881,18 @@ class TestRequire < Test::Unit::TestCase
end;
end
end
+
+ def test_symlink_load_path
+ Dir.mktmpdir {|tmp|
+ Dir.mkdir(File.join(tmp, "real"))
+ begin
+ File.symlink "real", File.join(tmp, "symlink")
+ rescue NotImplementedError, Errno::EACCES
+ skip "File.symlink is not implemented"
+ end
+ File.write(File.join(tmp, "real/a.rb"), "print __FILE__")
+ result = IO.popen([EnvUtil.rubybin, "-I#{tmp}/symlink", "-e", "require 'a.rb'"], &:read)
+ assert_operator(result, :end_with?, "/real/a.rb")
+ }
+ end
end