1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

merge revision(s) r45845,r45846,r45847: [Backport #9486]

* parse.y (local_tbl_gen): remove local variables duplicated with
	  arguments.

	* parse.y (new_bv_gen): no duplicated names, if already added in
	  shadowing_lvar().
	  [ruby-core:60501] [Bug #9486]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@46596 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nagachika 2014-06-28 05:51:57 +00:00
parent 85a3ceafec
commit 416f0075a2
4 changed files with 46 additions and 25 deletions

View file

@ -83,6 +83,18 @@ class TestVariable < Test::Unit::TestCase
end.call
end
def test_shadowing_local_variables
bug9486 = '[ruby-core:60501] [Bug #9486]'
x = tap {|x| break local_variables}
assert_equal([:x, :bug9486, :x], x)
end
def test_shadowing_block_local_variables
bug9486 = '[ruby-core:60501] [Bug #9486]'
x = tap {|;x| break local_variables}
assert_equal([:x, :bug9486, :x], x)
end
def test_global_variable_0
assert_in_out_err(["-e", "$0='t'*1000;print $0"], "", /\At+\z/, [])
end