summaryrefslogtreecommitdiff
path: root/test/ruby/test_require.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-09-21 07:29:20 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-09-21 07:29:20 +0000
commitb6d3927e16357408720203a949cfa8741b9ebf6c (patch)
treed26aaf1f7a35f7714142c027e24711f5696ae89d /test/ruby/test_require.rb
parent5754f15975d82896c2566ca01b9ce7b3122d67ec (diff)
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/trunk@59984 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_require.rb')
-rw-r--r--test/ruby/test_require.rb14
1 files changed, 14 insertions, 0 deletions
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