diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-12-08 05:27:10 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-12-08 05:27:10 +0000 |
commit | 8a6e731a138176c33e95d8964800b06905beaf83 (patch) | |
tree | e495e3702055d35e72535494ac9bef541ca5a81c /test | |
parent | 994de97db4704a7bc50e452b153d743e8c96c57f (diff) | |
download | ruby-8a6e731a138176c33e95d8964800b06905beaf83.tar.gz |
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
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_exception.rb | 10 |
1 files changed, 10 insertions, 0 deletions
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 |