ruby-changes:26479
From: naruse <ko1@a...>
Date: Fri, 21 Dec 2012 19:54:08 +0900 (JST)
Subject: [ruby-changes:26479] naruse:r38530 (trunk): Add test for r38529 [Bug #7536]
naruse 2012-12-21 19:53:57 +0900 (Fri, 21 Dec 2012) New Revision: 38530 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=38530 Log: Add test for r38529 [Bug #7536] Modified files: trunk/test/ruby/test_require.rb Index: test/ruby/test_require.rb =================================================================== --- test/ruby/test_require.rb (revision 38529) +++ test/ruby/test_require.rb (revision 38530) @@ -584,4 +584,17 @@ class TestRequire < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_require.rb#L584 def test_require_with_array_shift assert_require_with_shared_array_modified("unshift", "shift") end + + def test_require_local_var_on_toplevel + bug7536 = '[ruby-core:50701]' + Dir.mktmpdir {|tmp| + Dir.chdir(tmp) { + open("bar.rb", "w") {|f| f.puts 'TOPLEVEL_BINDING.eval("lib = 2")' } + assert_in_out_err(%w[-r./bar.rb], <<-INPUT, %w([:lib] 2), [], bug7536) + puts TOPLEVEL_BINDING.eval("local_variables").inspect + puts TOPLEVEL_BINDING.eval("lib").inspect + INPUT + } + } + end end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/