mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* vm_eval.c (rb_f_caller): return [] instead of nil when the function
is called on toplevel. [ruby-dev:41348] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27895 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
61086883b6
commit
56036e3514
3 changed files with 13 additions and 2 deletions
|
@ -228,6 +228,10 @@ class TestMethod < Test::Unit::TestCase
|
|||
assert_in_out_err([], "p __callee__", %w(nil), [])
|
||||
end
|
||||
|
||||
def test_caller_top_level
|
||||
assert_in_out_err([], "p caller", %w([]), [])
|
||||
end
|
||||
|
||||
def test_caller_negative_level
|
||||
assert_raise(ArgumentError) { caller(-1) }
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue