From 29756c5e94c6f273c6b1a1103d9c0b12570566ea Mon Sep 17 00:00:00 2001 From: shugo Date: Sun, 9 Dec 2012 08:48:34 +0000 Subject: * vm_insnhelper.c (vm_call_opt_send): Kernel#send should not use refinements. * proc.c (mnew): Kernel#method, Kernel#public_method, Module#instance_method, and Module#public_instance_method should not use refinements. * vm_method.c (rb_method_boundp): Kernel#respond_to? should not use refinements. * test/ruby/test_refinement.rb: related test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38279 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_refinement.rb | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'test') diff --git a/test/ruby/test_refinement.rb b/test/ruby/test_refinement.rb index a956535f60..97f6db9303 100644 --- a/test/ruby/test_refinement.rb +++ b/test/ruby/test_refinement.rb @@ -129,18 +129,18 @@ class TestRefinement < Test::Unit::TestCase assert_raise(NoMethodError) { foo.z } end - def test_new_method_by_send + def test_send_should_not_use_refinements foo = Foo.new assert_raise(NoMethodError) { foo.send(:z) } - assert_equal("FooExt#z", FooExtClient.send_z_on(foo)) + assert_raise(NoMethodError) { FooExtClient.send_z_on(foo) } assert_raise(NoMethodError) { foo.send(:z) } end - def test_new_method_by_method_object + def test_method_should_not_use_refinements foo = Foo.new - assert_raise(NoMethodError) { foo.send(:z) } - assert_equal("FooExt#z", FooExtClient.method_z(foo).call) - assert_raise(NoMethodError) { foo.send(:z) } + assert_raise(NameError) { foo.method(:z) } + assert_raise(NameError) { FooExtClient.method_z(foo) } + assert_raise(NameError) { foo.method(:z) } end def test_no_local_rebinding @@ -249,10 +249,9 @@ class TestRefinement < Test::Unit::TestCase end end - def test_respond_to? - assert_equal(false, 1.respond_to?(:foo)) - assert_equal(true, eval_using(FixnumFooExt, "1.respond_to?(:foo)")) + def test_respond_to_should_not_use_refinements assert_equal(false, 1.respond_to?(:foo)) + assert_equal(false, eval_using(FixnumFooExt, "1.respond_to?(:foo)")) end module StringCmpExt -- cgit v1.2.3