diff options
| author | Francois Chagnon <[email protected]> | 2016-11-17 14:52:52 -0500 |
|---|---|---|
| committer | Bouke van der Bijl <[email protected]> | 2016-11-24 10:51:29 -0500 |
| commit | a384bcce350acf5e8be5d45f0258e6ef5bdeb033 (patch) | |
| tree | 6b46993ba35c686b2a82a479ddde19c10097f7f1 /test | |
| parent | a630c4f413f6af764e68210430e8b61a435d38d7 (diff) | |
| download | mruby-a384bcce350acf5e8be5d45f0258e6ef5bdeb033.tar.gz mruby-a384bcce350acf5e8be5d45f0258e6ef5bdeb033.zip | |
Fix instances where return value of mrb_method_search_vm is unchecked
Reported by @charliesome
Diffstat (limited to 'test')
| -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..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 |
