diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2016-12-03 18:23:25 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2016-12-03 18:23:25 +0900 |
| commit | 802e396466142698af401f9700bfa61e67024074 (patch) | |
| tree | 7fa1f3b09ac0ffd3b44550a7e3478f3b5b1fc9fd /test/t | |
| parent | f6d199919d433adad03f2eb27757503bc61a5507 (diff) | |
| parent | 144006a20e7d97733d682ff1502f24b032b3db59 (diff) | |
| download | mruby-802e396466142698af401f9700bfa61e67024074.tar.gz mruby-802e396466142698af401f9700bfa61e67024074.zip | |
Merge branch 'bouk-method-missing-segfault'
Diffstat (limited to 'test/t')
| -rw-r--r-- | test/t/nomethoderror.rb | 31 |
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 |
