summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-09-12 15:52:03 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-09-12 15:52:03 +0000
commitc8f61740086a69ccff5af780c0fd884a15cb35cc (patch)
tree780da21aabdbc4593d6bf85184ec5b031730620f /test
parent97c3bad4782be995863b778afe189aea42b8afc6 (diff)
* test/ruby/test_require.rb (test_relative): test without current
directory. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24874 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_require.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/ruby/test_require.rb b/test/ruby/test_require.rb
index b2cdae3fda..510da8e272 100644
--- a/test/ruby/test_require.rb
+++ b/test/ruby/test_require.rb
@@ -247,6 +247,8 @@ class TestRequire < Test::Unit::TestCase
def test_relative
require 'tmpdir'
+ load_path = $:.dup
+ $:.delete(".")
Dir.mktmpdir do |tmp|
Dir.chdir(tmp) do
Dir.mkdir('x')
@@ -258,8 +260,12 @@ class TestRequire < Test::Unit::TestCase
assert_raise(LoadError) {require('x/t.rb')}
File.unlink(*Dir.glob('x/*'))
Dir.rmdir("#{tmp}/x")
+ $:.replace(load_path)
+ load_path = nil
assert(!require('tmpdir'))
end
end
+ ensure
+ $:.replace(load_path) if load_path
end
end