ruby-changes:25374
From: shugo <ko1@a...>
Date: Sat, 3 Nov 2012 09:09:45 +0900 (JST)
Subject: [ruby-changes:25374] shugo:r37431 (trunk): * test/ruby/test_refinement.rb (test_new_method_by_send,
shugo 2012-11-03 09:09:26 +0900 (Sat, 03 Nov 2012) New Revision: 37431 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=37431 Log: * test/ruby/test_refinement.rb (test_new_method_by_send, test_new_method_by_method_object): add tests for Kernel#send and Kernel#method with refinements. * test/ruby/test_refinement.rb (test_symbol_to_proc): add a test calling a proc created by Symbol#to_proc outside the scope where a refinement is closed over. Modified files: trunk/ChangeLog trunk/test/ruby/test_refinement.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 37430) +++ ChangeLog (revision 37431) @@ -1,3 +1,13 @@ +Sat Nov 3 09:03:34 2012 Shugo Maeda <shugo@r...> + + * test/ruby/test_refinement.rb (test_new_method_by_send, + test_new_method_by_method_object): add tests for Kernel#send and + Kernel#method with refinements. + + * test/ruby/test_refinement.rb (test_symbol_to_proc): add a test + calling a proc created by Symbol#to_proc outside the scope where + a refinement is closed over. + Sat Nov 3 04:14:19 2012 Nobuyoshi Nakada <nobu@r...> * vm.c (rb_vm_rewrite_ep_in_errinfo): rewrite all catch points in Index: test/ruby/test_refinement.rb =================================================================== --- test/ruby/test_refinement.rb (revision 37430) +++ test/ruby/test_refinement.rb (revision 37431) @@ -72,6 +72,14 @@ return foo.z end + def self.send_z_on(foo) + return foo.send(:z) + end + + def self.method_z(foo) + return foo.method(:z) + end + def self.invoke_call_x_on(foo) return foo.call_x end @@ -114,6 +122,20 @@ assert_raise(NoMethodError) { foo.z } end + def test_new_method_by_send + foo = Foo.new + assert_raise(NoMethodError) { foo.send(:z) } + assert_equal("FooExt#z", FooExtClient.send_z_on(foo)) + assert_raise(NoMethodError) { foo.send(:z) } + end + + def test_new_method_by_method_object + foo = Foo.new + assert_raise(NoMethodError) { foo.send(:z) } + assert_equal("FooExt#z", FooExtClient.method_z(foo).call) + assert_raise(NoMethodError) { foo.send(:z) } + end + def test_no_local_rebinding foo = Foo.new assert_equal("Foo#x", foo.call_x) @@ -616,11 +638,16 @@ c = C.new :foo.to_proc.call(c) end + + def self.foo_proc + :foo.to_proc + end end end def test_symbol_to_proc assert_equal("foo", SymbolToProc::M.call_foo) + assert_equal("foo", SymbolToProc::M.foo_proc.call(SymbolToProc::C.new)) end module Inspect -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/