summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-02-16 16:25:40 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-02-16 16:25:40 +0000
commiteaba9da1d13fac380fe94f977d7f8d89bd40cde0 (patch)
treeb17e09f3ce10f925571e406c0deed966270c7804 /test
parent99c76a47ef8c65a27ee6d9a7dab03671dc22647a (diff)
merge revision(s) 59983,59984: [Backport #10222] [Backport #14372] [Backport #14424]
file.c: rb_check_realpath * file.c (rb_check_realpath): returns real path which has no symbolic links. similar to rb_realpath except for returning Qnil if any parts did not exist. load.c: real path to load * load.c (rb_construct_expanded_load_path): expand load paths to real paths to get rid of duplicate loading from symbolic-linked directories. [Feature #10222] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_4@62440 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-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 d7038bb578..ee212083a3 100644
--- a/test/ruby/test_exception.rb
+++ b/test/ruby/test_exception.rb
@@ -983,7 +983,7 @@ $stderr = $stdout; raise "\x82\xa0"') do |outs, errs, status|
path = nil
Tempfile.create(%w[circular .rb]) do |t|
begin
- 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 dbd6117ba2..533e1b27d7 100644
--- a/test/ruby/test_require.rb
+++ b/test/ruby/test_require.rb
@@ -809,4 +809,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