summaryrefslogtreecommitdiffhomepage
path: root/test/t
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2016-12-03 18:23:25 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2016-12-03 18:23:25 +0900
commit802e396466142698af401f9700bfa61e67024074 (patch)
tree7fa1f3b09ac0ffd3b44550a7e3478f3b5b1fc9fd /test/t
parentf6d199919d433adad03f2eb27757503bc61a5507 (diff)
parent144006a20e7d97733d682ff1502f24b032b3db59 (diff)
downloadmruby-802e396466142698af401f9700bfa61e67024074.tar.gz
mruby-802e396466142698af401f9700bfa61e67024074.zip
Merge branch '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..1c09bc20e 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(NoMethodError) 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(NoMethodError) 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