From 56036e3514a5afa76c60b7850277da63c4de93b1 Mon Sep 17 00:00:00 2001 From: mame Date: Wed, 19 May 2010 11:18:12 +0000 Subject: * 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 --- test/ruby/test_method.rb | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'test/ruby') diff --git a/test/ruby/test_method.rb b/test/ruby/test_method.rb index ddeb6d6c87..86ab64feb1 100644 --- a/test/ruby/test_method.rb +++ b/test/ruby/test_method.rb @@ -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 -- cgit v1.2.3