diff options
author | tenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-05-16 15:02:41 +0000 |
---|---|---|
committer | tenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-05-16 15:02:41 +0000 |
commit | d7188cc95c5d2f52ce553beac0a5c9b58a4a5c7f (patch) | |
tree | ceff988ddd33f1a040f84660bbed899ce54fcaf4 | |
parent | b837025d778f54ef132bca2b15a2dd769536ef2f (diff) | |
download | ruby-d7188cc95c5d2f52ce553beac0a5c9b58a4a5c7f.tar.gz |
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
-rw-r--r-- | test/ruby/test_require.rb | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/test/ruby/test_require.rb b/test/ruby/test_require.rb index 3b7f6a7977..b7797f0877 100644 --- a/test/ruby/test_require.rb +++ b/test/ruby/test_require.rb @@ -574,7 +574,7 @@ class TestRequire < Test::Unit::TestCase Dir.mktmpdir {|tmp| Dir.chdir(tmp) { 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]) a = Object.new def a.to_path @@ -584,7 +584,8 @@ class TestRequire < Test::Unit::TestCase begin require "foo" p [:ng, $LOAD_PATH, ENV['RUBYLIB']] - rescue LoadError + rescue LoadError => e + raise unless e.path == "foo" end def a.to_path "#{tmp}" @@ -600,7 +601,7 @@ class TestRequire < Test::Unit::TestCase Dir.mktmpdir {|tmp| Dir.chdir(tmp) { 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]) a = Object.new def a.to_str @@ -610,7 +611,8 @@ class TestRequire < Test::Unit::TestCase begin require "foo" p [:ng, $LOAD_PATH, ENV['RUBYLIB']] - rescue LoadError + rescue LoadError => e + raise unless e.path == "foo" end def a.to_str "#{tmp}" @@ -628,7 +630,7 @@ class TestRequire < Test::Unit::TestCase open("foo.rb", "w") {} Dir.mkdir("a") 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]) $:.#{add} "#{tmp}" $:.#{add} "#{tmp}/a" @@ -637,8 +639,12 @@ class TestRequire < Test::Unit::TestCase # Expanded load path cache should be rebuilt. begin require "bar" - rescue LoadError - p :ok + rescue LoadError => e + if e.path == "bar" + p :ok + else + raise + end end INPUT } |