diff options
author | shugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-12-09 08:48:34 +0000 |
---|---|---|
committer | shugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-12-09 08:48:34 +0000 |
commit | 29756c5e94c6f273c6b1a1103d9c0b12570566ea (patch) | |
tree | bf3a399a7074285a5137d279286f0a5f604467c3 /test | |
parent | 1cf13e078593c31aec06e4749287aceab989baf6 (diff) | |
download | ruby-29756c5e94c6f273c6b1a1103d9c0b12570566ea.tar.gz |
* 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
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_refinement.rb | 17 |
1 files changed, 8 insertions, 9 deletions
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 |