summaryrefslogtreecommitdiffhomepage
path: root/test/t
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2016-12-03 18:20:29 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2016-12-03 18:20:29 +0900
commit8f510be21109ef52692bbca01b1868e6e247e40f (patch)
tree655de9e12298f013934f607d1266015b8b18ed89 /test/t
parentf6d199919d433adad03f2eb27757503bc61a5507 (diff)
parenta384bcce350acf5e8be5d45f0258e6ef5bdeb033 (diff)
downloadmruby-8f510be21109ef52692bbca01b1868e6e247e40f.tar.gz
mruby-8f510be21109ef52692bbca01b1868e6e247e40f.zip
Merge branch 'method-missing-segfault' of https://github.com/bouk/mruby into bouk-method-missing-segfault
Diffstat (limited to 'test/t')
-rw-r--r--test/t/nomethoderror.rb31
1 files changed, 31 insertions, 0 deletions
diff --git a/test/t/nomethoderror.rb b/test/t/nomethoderror.rb
index 5fed79689..ce3514782 100644
--- a/test/t/nomethoderror.rb
+++ b/test/t/nomethoderror.rb
@@ -20,3 +20,34 @@ assert('NoMethodError#args', '15.2.32.2.1') do
end
end
end
+
+assert('Can still raise when BasicObject#method_missing is removed') do
+ assert_raise(TypeError) do
+ begin
+ BasicObject.alias_method(:old_method_missing, :method_missing)
+ BasicObject.remove_method(:method_missing)
+ 1.__send__(:foo)
+ ensure
+ BasicObject.alias_method(:method_missing, :old_method_missing)
+ BasicObject.remove_method(:old_method_missing)
+ end
+ end
+end
+
+assert('Can still call super when BasicObject#method_missing is removed') do
+ assert_raise(TypeError) do
+ class A
+ def foo
+ super
+ end
+ end
+ begin
+ BasicObject.alias_method(:old_method_missing, :method_missing)
+ BasicObject.remove_method(:method_missing)
+ A.new.foo
+ ensure
+ BasicObject.alias_method(:method_missing, :old_method_missing)
+ BasicObject.remove_method(:old_method_missing)
+ end
+ end
+end