mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
test_require.rb: clear load path
* test/ruby/test_require.rb (test_require_invalid_shared_object), (test_require_too_long_filename, test_require_changed_current_dir), (test_require_not_modified_load_path, test_require_changed_home), (test_require_to_path_redefined_in_load_path), (test_require_to_str_redefined_in_load_path), (assert_require_with_shared_array_modified): clear preset load path so that unexpected files will not get loaded. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38486 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
0de805f62b
commit
4407145294
1 changed files with 8 additions and 0 deletions
|
@ -19,6 +19,7 @@ class TestRequire < Test::Unit::TestCase
|
||||||
t.close
|
t.close
|
||||||
|
|
||||||
assert_in_out_err([], <<-INPUT, %w(:ok), [])
|
assert_in_out_err([], <<-INPUT, %w(:ok), [])
|
||||||
|
$:.replace([IO::NULL])
|
||||||
begin
|
begin
|
||||||
require \"#{ t.path }\"
|
require \"#{ t.path }\"
|
||||||
rescue LoadError
|
rescue LoadError
|
||||||
|
@ -29,6 +30,7 @@ class TestRequire < Test::Unit::TestCase
|
||||||
|
|
||||||
def test_require_too_long_filename
|
def test_require_too_long_filename
|
||||||
assert_in_out_err(["RUBYOPT"=>nil], <<-INPUT, %w(:ok), [])
|
assert_in_out_err(["RUBYOPT"=>nil], <<-INPUT, %w(:ok), [])
|
||||||
|
$:.replace([IO::NULL])
|
||||||
begin
|
begin
|
||||||
require '#{ "foo/" * 10000 }foo'
|
require '#{ "foo/" * 10000 }foo'
|
||||||
rescue LoadError
|
rescue LoadError
|
||||||
|
@ -447,6 +449,7 @@ class TestRequire < Test::Unit::TestCase
|
||||||
f.puts "p :ok"
|
f.puts "p :ok"
|
||||||
}
|
}
|
||||||
assert_in_out_err([], <<-INPUT, %w(:ok), [], bug7158)
|
assert_in_out_err([], <<-INPUT, %w(:ok), [], bug7158)
|
||||||
|
$:.replace([IO::NULL])
|
||||||
$: << "."
|
$: << "."
|
||||||
Dir.chdir("a")
|
Dir.chdir("a")
|
||||||
require "foo"
|
require "foo"
|
||||||
|
@ -465,6 +468,7 @@ class TestRequire < Test::Unit::TestCase
|
||||||
Dir.chdir(tmp) {
|
Dir.chdir(tmp) {
|
||||||
open("foo.rb", "w") {}
|
open("foo.rb", "w") {}
|
||||||
assert_in_out_err([], <<-INPUT, %w(:ok), [], bug7158)
|
assert_in_out_err([], <<-INPUT, %w(:ok), [], bug7158)
|
||||||
|
$:.replace([IO::NULL])
|
||||||
a = Object.new
|
a = Object.new
|
||||||
def a.to_str
|
def a.to_str
|
||||||
"#{tmp}"
|
"#{tmp}"
|
||||||
|
@ -486,6 +490,7 @@ class TestRequire < Test::Unit::TestCase
|
||||||
Dir.mkdir("a")
|
Dir.mkdir("a")
|
||||||
open(File.join("a", "bar.rb"), "w") {}
|
open(File.join("a", "bar.rb"), "w") {}
|
||||||
assert_in_out_err([], <<-INPUT, %w(:ok), [], bug7158)
|
assert_in_out_err([], <<-INPUT, %w(:ok), [], bug7158)
|
||||||
|
$:.replace([IO::NULL])
|
||||||
$: << '~'
|
$: << '~'
|
||||||
ENV['HOME'] = "#{tmp}"
|
ENV['HOME'] = "#{tmp}"
|
||||||
require "foo"
|
require "foo"
|
||||||
|
@ -502,6 +507,7 @@ class TestRequire < Test::Unit::TestCase
|
||||||
Dir.chdir(tmp) {
|
Dir.chdir(tmp) {
|
||||||
open("foo.rb", "w") {}
|
open("foo.rb", "w") {}
|
||||||
assert_in_out_err(["RUBYOPT"=>nil], <<-INPUT, %w(:ok), [], bug7158)
|
assert_in_out_err(["RUBYOPT"=>nil], <<-INPUT, %w(:ok), [], bug7158)
|
||||||
|
$:.replace([IO::NULL])
|
||||||
a = Object.new
|
a = Object.new
|
||||||
def a.to_path
|
def a.to_path
|
||||||
"bar"
|
"bar"
|
||||||
|
@ -527,6 +533,7 @@ class TestRequire < Test::Unit::TestCase
|
||||||
Dir.chdir(tmp) {
|
Dir.chdir(tmp) {
|
||||||
open("foo.rb", "w") {}
|
open("foo.rb", "w") {}
|
||||||
assert_in_out_err(["RUBYOPT"=>nil], <<-INPUT, %w(:ok), [], bug7158)
|
assert_in_out_err(["RUBYOPT"=>nil], <<-INPUT, %w(:ok), [], bug7158)
|
||||||
|
$:.replace([IO::NULL])
|
||||||
a = Object.new
|
a = Object.new
|
||||||
def a.to_str
|
def a.to_str
|
||||||
"foo"
|
"foo"
|
||||||
|
@ -554,6 +561,7 @@ class TestRequire < Test::Unit::TestCase
|
||||||
Dir.mkdir("a")
|
Dir.mkdir("a")
|
||||||
open(File.join("a", "bar.rb"), "w") {}
|
open(File.join("a", "bar.rb"), "w") {}
|
||||||
assert_in_out_err([], <<-INPUT, %w(:ok), [], bug7383)
|
assert_in_out_err([], <<-INPUT, %w(:ok), [], bug7383)
|
||||||
|
$:.replace([IO::NULL])
|
||||||
$:.#{add} "#{tmp}"
|
$:.#{add} "#{tmp}"
|
||||||
$:.#{add} "#{tmp}/a"
|
$:.#{add} "#{tmp}/a"
|
||||||
require "foo"
|
require "foo"
|
||||||
|
|
Loading…
Reference in a new issue