From a76dc04aa832172495f48e0320e077906c6f7625 Mon Sep 17 00:00:00 2001 From: "Yukihiro \"Matz\" Matsumoto" Date: Mon, 27 Feb 2017 23:11:39 +0900 Subject: Remove default Kernel#method_missing. Internal method_missing works without problems. --- test/t/nomethoderror.rb | 31 ------------------------------- 1 file changed, 31 deletions(-) (limited to 'test') diff --git a/test/t/nomethoderror.rb b/test/t/nomethoderror.rb index 35cbdaee9..22a5f8a0e 100644 --- a/test/t/nomethoderror.rb +++ b/test/t/nomethoderror.rb @@ -21,37 +21,6 @@ assert('NoMethodError#args', '15.2.32.2.1') do end end -assert('Can still raise when Kernel#method_missing is removed') do - assert_raise(NoMethodError) do - begin - Kernel.alias_method(:old_method_missing, :method_missing) - Kernel.remove_method(:method_missing) - 1.__send__(:foo) - ensure - Kernel.alias_method(:method_missing, :old_method_missing) - Kernel.remove_method(:old_method_missing) - end - end -end - -assert('Can still call super when Kernel#method_missing is removed') do - assert_raise(NoMethodError) do - class A - def foo - super - end - end - begin - Kernel.alias_method(:old_method_missing, :method_missing) - Kernel.remove_method(:method_missing) - A.new.foo - ensure - Kernel.alias_method(:method_missing, :old_method_missing) - Kernel.remove_method(:old_method_missing) - end - end -end - assert("NoMethodError#new does not return an exception") do begin class << NoMethodError -- cgit v1.2.3