mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
test_require.rb: same process
* test/ruby/test_require.rb (assert_require_nonascii_path): run in same process. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42186 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
4af852faa2
commit
45c4d82823
1 changed files with 8 additions and 4 deletions
|
@ -78,17 +78,21 @@ class TestRequire < Test::Unit::TestCase
|
||||||
end
|
end
|
||||||
Dir.mkdir(File.dirname(require_path))
|
Dir.mkdir(File.dirname(require_path))
|
||||||
open(require_path, "wb") {}
|
open(require_path, "wb") {}
|
||||||
assert_separately(%w[--disable=gems], <<-INPUT)
|
begin
|
||||||
|
load_path = $:.dup
|
||||||
|
features = $".dup
|
||||||
# leave paths for require encoding objects
|
# leave paths for require encoding objects
|
||||||
bug = "#{bug} require #{encoding} path"
|
bug = "#{bug} require #{encoding} path"
|
||||||
require_path = "#{require_path}"
|
require_path = "#{require_path}"
|
||||||
enc_path = Regexp.new(Regexp.escape(RUBY_PLATFORM))
|
$:.clear
|
||||||
$:.replace([IO::NULL] + $:.reject {|path| enc_path !~ path})
|
|
||||||
assert_nothing_raised(LoadError, bug) {
|
assert_nothing_raised(LoadError, bug) {
|
||||||
assert(require(require_path), bug)
|
assert(require(require_path), bug)
|
||||||
assert(!require(require_path), bug)
|
assert(!require(require_path), bug)
|
||||||
}
|
}
|
||||||
INPUT
|
ensure
|
||||||
|
$:.replace(load_path)
|
||||||
|
$".replace(features)
|
||||||
|
end
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue