From c8a28a5a1b53cf92c0939cee92a1f8dbcc1b86d5 Mon Sep 17 00:00:00 2001 From: nobu Date: Fri, 20 Mar 2015 09:41:06 +0000 Subject: proc.c: respond_to_missing? at Method * proc.c (respond_to_missing_p): check if the receiver responds to the given method by respond_to_missing?. * proc.c (mnew_missing): create Method object for method_missing. [ruby-core:68564] [Bug #10985] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50038 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/-ext-/symbol/test_inadvertent_creation.rb | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'test/-ext-/symbol') diff --git a/test/-ext-/symbol/test_inadvertent_creation.rb b/test/-ext-/symbol/test_inadvertent_creation.rb index 081debdd29..c7c8b5ace5 100644 --- a/test/-ext-/symbol/test_inadvertent_creation.rb +++ b/test/-ext-/symbol/test_inadvertent_creation.rb @@ -82,6 +82,28 @@ module Test_Symbol assert_not_interned_false(c, :class_variable_defined?, noninterned_name("@@"), feature5072) end + def test_missing_method + bug10985 = '[ruby-core:68564] [Bug #10985]' + m = nil + c = Class.new do + def self.respond_to_missing?(*) + true + end + end + + s = noninterned_name + assert_nothing_raised(NameError, bug10985) {m = c.method(s)} + assert_raise_with_message(NoMethodError, /#{s}/) {m.call} + + s = noninterned_name + assert_nothing_raised(NameError, bug10985) {m = c.public_method(s.to_sym)} + assert_raise_with_message(NoMethodError, /#{s}/) {m.call} + + s = noninterned_name + assert_nothing_raised(NameError, bug10985) {m = c.singleton_method(s.to_sym)} + assert_raise_with_message(NoMethodError, /#{s}/) {m.call} + end + Feature5079 = '[ruby-core:38404]' def test_undefined_instance_variable -- cgit v1.2.3