ruby-changes:38432
From: tenderlove <ko1@a...>
Date: Sun, 17 May 2015 00:03:01 +0900 (JST)
Subject: [ruby-changes:38432] tenderlove:r50513 (trunk): fix test failures introduced in r50494
tenderlove 2015-05-17 00:02:41 +0900 (Sun, 17 May 2015) New Revision: 50513 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=50513 Log: 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. Modified files: trunk/test/ruby/test_require.rb Index: test/ruby/test_require.rb =================================================================== --- test/ruby/test_require.rb (revision 50512) +++ test/ruby/test_require.rb (revision 50513) @@ -574,7 +574,7 @@ class TestRequire < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_require.rb#L574 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 https://github.com/ruby/ruby/blob/trunk/test/ruby/test_require.rb#L584 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 https://github.com/ruby/ruby/blob/trunk/test/ruby/test_require.rb#L601 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 https://github.com/ruby/ruby/blob/trunk/test/ruby/test_require.rb#L611 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 https://github.com/ruby/ruby/blob/trunk/test/ruby/test_require.rb#L630 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 https://github.com/ruby/ruby/blob/trunk/test/ruby/test_require.rb#L639 # 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 } -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/