1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* 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
This commit is contained in:
nobu 2009-09-12 15:52:03 +00:00
parent 97c3bad478
commit c8f6174008

View file

@ -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