fix test failures introduced in r50494
This commit changes some of the `require` tests to run *without* rubygems enabled. Those particular tests were removing rubygems from $LOAD_PATH. These tests assert that a `LoadError` is raised. Unfortunately, since RubyGems was enabled by default and was not fully loaded, the load error actually originated from RubyGems, *not* from where the tests intended. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50513 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
b837025d77
commit
d7188cc95c
@ -574,7 +574,7 @@ class TestRequire < Test::Unit::TestCase
|
|||||||
Dir.mktmpdir {|tmp|
|
Dir.mktmpdir {|tmp|
|
||||||
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}, '--disable-gems'], <<-INPUT, %w(:ok), [], bug7158)
|
||||||
$:.replace([IO::NULL])
|
$:.replace([IO::NULL])
|
||||||
a = Object.new
|
a = Object.new
|
||||||
def a.to_path
|
def a.to_path
|
||||||
@ -584,7 +584,8 @@ class TestRequire < Test::Unit::TestCase
|
|||||||
begin
|
begin
|
||||||
require "foo"
|
require "foo"
|
||||||
p [:ng, $LOAD_PATH, ENV['RUBYLIB']]
|
p [:ng, $LOAD_PATH, ENV['RUBYLIB']]
|
||||||
rescue LoadError
|
rescue LoadError => e
|
||||||
|
raise unless e.path == "foo"
|
||||||
end
|
end
|
||||||
def a.to_path
|
def a.to_path
|
||||||
"#{tmp}"
|
"#{tmp}"
|
||||||
@ -600,7 +601,7 @@ class TestRequire < Test::Unit::TestCase
|
|||||||
Dir.mktmpdir {|tmp|
|
Dir.mktmpdir {|tmp|
|
||||||
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}, '--disable-gems'], <<-INPUT, %w(:ok), [], bug7158)
|
||||||
$:.replace([IO::NULL])
|
$:.replace([IO::NULL])
|
||||||
a = Object.new
|
a = Object.new
|
||||||
def a.to_str
|
def a.to_str
|
||||||
@ -610,7 +611,8 @@ class TestRequire < Test::Unit::TestCase
|
|||||||
begin
|
begin
|
||||||
require "foo"
|
require "foo"
|
||||||
p [:ng, $LOAD_PATH, ENV['RUBYLIB']]
|
p [:ng, $LOAD_PATH, ENV['RUBYLIB']]
|
||||||
rescue LoadError
|
rescue LoadError => e
|
||||||
|
raise unless e.path == "foo"
|
||||||
end
|
end
|
||||||
def a.to_str
|
def a.to_str
|
||||||
"#{tmp}"
|
"#{tmp}"
|
||||||
@ -628,7 +630,7 @@ class TestRequire < Test::Unit::TestCase
|
|||||||
open("foo.rb", "w") {}
|
open("foo.rb", "w") {}
|
||||||
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(['--disable-gems'], <<-INPUT, %w(:ok), [], bug7383)
|
||||||
$:.replace([IO::NULL])
|
$:.replace([IO::NULL])
|
||||||
$:.#{add} "#{tmp}"
|
$:.#{add} "#{tmp}"
|
||||||
$:.#{add} "#{tmp}/a"
|
$:.#{add} "#{tmp}/a"
|
||||||
@ -637,8 +639,12 @@ class TestRequire < Test::Unit::TestCase
|
|||||||
# Expanded load path cache should be rebuilt.
|
# Expanded load path cache should be rebuilt.
|
||||||
begin
|
begin
|
||||||
require "bar"
|
require "bar"
|
||||||
rescue LoadError
|
rescue LoadError => e
|
||||||
p :ok
|
if e.path == "bar"
|
||||||
|
p :ok
|
||||||
|
else
|
||||||
|
raise
|
||||||
|
end
|
||||||
end
|
end
|
||||||
INPUT
|
INPUT
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user