diff options
| author | mame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-05-14 12:52:17 +0000 |
|---|---|---|
| committer | mame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-05-14 12:52:17 +0000 |
| commit | d9270014832a6bea170e7c310e4550c2c515f855 (patch) | |
| tree | 6a4ea2196159042da8c2751244d3e612d335217e /test/ruby/test_method.rb | |
| parent | c05f3423ae753a3d273cec6b14780268fc188c7b (diff) | |
| download | ruby-d9270014832a6bea170e7c310e4550c2c515f855.tar.gz ruby-d9270014832a6bea170e7c310e4550c2c515f855.tar.xz ruby-d9270014832a6bea170e7c310e4550c2c515f855.zip | |
* test/ruby/test_object.rb: new tests to achieve over 90% test
coverage of object.c, eval.c and eval_method.c.
* test/ruby/test_module.rb: ditto.
* test/ruby/test_trace.rb: ditto.
* test/ruby/test_integer.rb: ditto.
* test/ruby/test_float.rb: ditto.
* test/ruby/test_method.rb: ditto.
* test/ruby/test_variable.rb: ditto.
* test/ruby/test_eval.rb: ditto.
* test/ruby/test_exception.rb: ditto.
* test/ruby/test_class.rb: ditto.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@16418 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_method.rb')
| -rw-r--r-- | test/ruby/test_method.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/ruby/test_method.rb b/test/ruby/test_method.rb index f4055e795..df0ec792f 100644 --- a/test/ruby/test_method.rb +++ b/test/ruby/test_method.rb @@ -1,4 +1,5 @@ require 'test/unit' +require_relative 'envutil' class TestMethod < Test::Unit::TestCase def setup @@ -10,6 +11,10 @@ class TestMethod < Test::Unit::TestCase $VERBOSE = @verbose end + def ruby(*r, &b) + EnvUtil.rubyexec(*r, &b) + end + def m0() end def m1(a) end def m2(a, b) end @@ -202,4 +207,17 @@ class TestMethod < Test::Unit::TestCase m2 = c2.new.method(:foo) assert_equal("#<Method: #{ c2.inspect }(#{ c.inspect })#foo>", m2.inspect) end + + def test_callee_top_level + ruby do |w, r, e| + w.puts "p __callee__" + w.close + assert_equal("nil", r.read.chomp) + assert_match("", e.read.chomp) + end + end + + def test_caller_negative_level + assert_raise(ArgumentError) { caller(-1) } + end end |
