mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* eval.c (rb_method_missing): adjusted format and argument number.
* eval.c (rb_call): fixed for super in cached method. [ruby-dev:39757] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@25890 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
54090ad09b
commit
6ead29d044
3 changed files with 38 additions and 2 deletions
|
@ -283,6 +283,33 @@ class TestObject < Test::Unit::TestCase
|
|||
assert_raise(ArgumentError) { 1.send }
|
||||
end
|
||||
|
||||
def test_no_superclass_method
|
||||
o = Object.new
|
||||
e = assert_raise(NoMethodError) {
|
||||
o.method(:__send__).call(:never_defined_test_no_superclass_method)
|
||||
}
|
||||
m1 = e.message
|
||||
assert_no_match(/no superclass method/, m1)
|
||||
e = assert_raise(NoMethodError) {
|
||||
o.method(:__send__).call(:never_defined_test_no_superclass_method)
|
||||
}
|
||||
assert_equal(m1, e.message)
|
||||
e = assert_raise(NoMethodError) {
|
||||
o.never_defined_test_no_superclass_method
|
||||
}
|
||||
assert_equal(m1, e.message)
|
||||
end
|
||||
|
||||
def test_superclass_method
|
||||
o = Object.new
|
||||
def o.foo; super; end
|
||||
e = assert_raise(NoMethodError) {o.foo}
|
||||
m1 = e.message
|
||||
assert_match(/no superclass method/, m1)
|
||||
e = assert_raise(NoMethodError) {o.foo}
|
||||
assert_equal(m1, e.message)
|
||||
end
|
||||
|
||||
def test_specific_eval_with_wrong_arguments
|
||||
assert_raise(ArgumentError) do
|
||||
1.instance_eval("foo") { foo }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue