From a11831a9a559c296617559f664bcba0aab254563 Mon Sep 17 00:00:00 2001 From: nobu Date: Tue, 24 Dec 2013 16:03:12 +0000 Subject: proc.c: Binding#local_variables * proc.c (bind_local_variables): allowing binding to list its local variables. patch by Jack Danger Canty at [ruby-core:56543]. [Feature #8773] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44392 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_variable.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'test/ruby/test_variable.rb') diff --git a/test/ruby/test_variable.rb b/test/ruby/test_variable.rb index 32b3d61573..321cd7e4c5 100644 --- a/test/ruby/test_variable.rb +++ b/test/ruby/test_variable.rb @@ -83,6 +83,17 @@ class TestVariable < Test::Unit::TestCase end.call end + def local_variables_of(bind) + this_should_not_be_in_bind = 2 + bind.local_variables + end + + def test_local_variables_from_other_method_binding + feature8773 = '[Feature #8773]' + x = 1 + assert_equal([:x], local_variables_of(binding), feature8773) + end + def test_global_variable_0 assert_in_out_err(["-e", "$0='t'*1000;print $0"], "", /\At+\z/, []) end -- cgit v1.2.3