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:
parent
97c3bad478
commit
c8f6174008
1 changed files with 6 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue