ruby-changes:26435
From: nobu <ko1@a...>
Date: Thu, 20 Dec 2012 12:44:01 +0900 (JST)
Subject: [ruby-changes:26435] nobu:r38486 (trunk): test_require.rb: clear load path
nobu 2012-12-20 12:43:53 +0900 (Thu, 20 Dec 2012) New Revision: 38486 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=38486 Log: 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. Modified files: trunk/test/ruby/test_require.rb Index: test/ruby/test_require.rb =================================================================== --- test/ruby/test_require.rb (revision 38485) +++ test/ruby/test_require.rb (revision 38486) @@ -19,6 +19,7 @@ class TestRequire < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_require.rb#L19 t.close assert_in_out_err([], <<-INPUT, %w(:ok), []) + $:.replace([IO::NULL]) begin require \"#{ t.path }\" rescue LoadError @@ -29,6 +30,7 @@ class TestRequire < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_require.rb#L30 def test_require_too_long_filename assert_in_out_err(["RUBYOPT"=>nil], <<-INPUT, %w(:ok), []) + $:.replace([IO::NULL]) begin require '#{ "foo/" * 10000 }foo' rescue LoadError @@ -447,6 +449,7 @@ class TestRequire < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_require.rb#L449 f.puts "p :ok" } assert_in_out_err([], <<-INPUT, %w(:ok), [], bug7158) + $:.replace([IO::NULL]) $: << "." Dir.chdir("a") require "foo" @@ -465,6 +468,7 @@ class TestRequire < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_require.rb#L468 Dir.chdir(tmp) { open("foo.rb", "w") {} assert_in_out_err([], <<-INPUT, %w(:ok), [], bug7158) + $:.replace([IO::NULL]) a = Object.new def a.to_str "#{tmp}" @@ -486,6 +490,7 @@ class TestRequire < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_require.rb#L490 Dir.mkdir("a") open(File.join("a", "bar.rb"), "w") {} assert_in_out_err([], <<-INPUT, %w(:ok), [], bug7158) + $:.replace([IO::NULL]) $: << '~' ENV['HOME'] = "#{tmp}" require "foo" @@ -502,6 +507,7 @@ class TestRequire < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_require.rb#L507 Dir.chdir(tmp) { open("foo.rb", "w") {} assert_in_out_err(["RUBYOPT"=>nil], <<-INPUT, %w(:ok), [], bug7158) + $:.replace([IO::NULL]) a = Object.new def a.to_path "bar" @@ -527,6 +533,7 @@ class TestRequire < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_require.rb#L533 Dir.chdir(tmp) { open("foo.rb", "w") {} assert_in_out_err(["RUBYOPT"=>nil], <<-INPUT, %w(:ok), [], bug7158) + $:.replace([IO::NULL]) a = Object.new def a.to_str "foo" @@ -554,6 +561,7 @@ class TestRequire < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_require.rb#L561 Dir.mkdir("a") open(File.join("a", "bar.rb"), "w") {} assert_in_out_err([], <<-INPUT, %w(:ok), [], bug7383) + $:.replace([IO::NULL]) $:.#{add} "#{tmp}" $:.#{add} "#{tmp}/a" require "foo" -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/