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
This commit is contained in:
nobu 2015-12-08 05:27:10 +00:00
parent cb3b463a50
commit 506b25aabf
6 changed files with 75 additions and 1 deletions

View file

@ -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