From 506b25aabf66c54cffe478958f8672f7fe6fa669 Mon Sep 17 00:00:00 2001 From: nobu Date: Tue, 8 Dec 2015 05:27:10 +0000 Subject: error.c: name_err_local_variables * error.c (name_err_local_variables): new method NameError#local_variables for internal use only. [Feature #11777] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52942 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_exception.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'test') diff --git a/test/ruby/test_exception.rb b/test/ruby/test_exception.rb index fd58ed5933..707a99f805 100644 --- a/test/ruby/test_exception.rb +++ b/test/ruby/test_exception.rb @@ -688,6 +688,16 @@ end.join assert_equal(:foo, e.name) assert_equal([1, 2], e.args) assert_same(obj, e.receiver) + def obj.test(a, b=nil, *c, &d) + e = a + 1.times {|f| g = foo} + end + e = assert_raise(NameError) { + obj.test(3) + } + assert_equal(:foo, e.name) + assert_same(obj, e.receiver) + assert_equal(%i[a b c d e f g], e.local_variables.sort) end def test_output_string_encoding -- cgit v1.2.3