diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-03-12 03:44:40 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-03-12 03:44:40 +0000 |
commit | a2229db3e8a88002697ee2fcb45128bcf4914bbd (patch) | |
tree | 3a4540a7f5b889307fb1215b3d3bbab179c194a5 /test/ruby | |
parent | b19f3a8a1592bf32bd83e02c433715cd67923d1d (diff) | |
download | ruby-a2229db3e8a88002697ee2fcb45128bcf4914bbd.tar.gz |
* vm_method.c (Init_eval_method): copy basic methods to Exception.
[ruby-core:40287][Bug #5473]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34983 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-rw-r--r-- | test/ruby/test_object.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/ruby/test_object.rb b/test/ruby/test_object.rb index eca1be78d5..f4a38e0ee3 100644 --- a/test/ruby/test_object.rb +++ b/test/ruby/test_object.rb @@ -728,4 +728,22 @@ class TestObject < Test::Unit::TestCase :foo.singleton_class end end + + def test_redef_method_missing + bug5473 = '[ruby-core:40287]' + ['ArgumentError.new("bug5473")', 'ArgumentError, "bug5473"', '"bug5473"'].each do |code| + out, err, status = EnvUtil.invoke_ruby([], <<-SRC, true, true) + class ::Object + def method_missing(m, *a, &b) + raise #{code} + end + end + + p((1.foo rescue $!)) + SRC + assert_send([status, :success?], bug5473) + assert_equal("", err, bug5473) + assert_equal((eval("raise #{code}") rescue $!.inspect), out.chomp, bug5473) + end + end end |