[前][次][番号順一覧][スレッド一覧]

ruby-changes:44404

From: nobu <ko1@a...>
Date: Sun, 23 Oct 2016 11:04:04 +0900 (JST)
Subject: [ruby-changes:44404] nobu:r56476 (trunk): test_refinement.rb: Symbol#to_proc test

nobu	2016-10-23 11:03:56 +0900 (Sun, 23 Oct 2016)

  New Revision: 56476

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=56476

  Log:
    test_refinement.rb: Symbol#to_proc test
    
    * test/ruby/test_refinement.rb (test_symbol_proc): a Symbol is
      converted to a Proc in the caller's context.  [Feature #9451]

  Modified files:
    trunk/test/ruby/test_refinement.rb
Index: test/ruby/test_refinement.rb
===================================================================
--- test/ruby/test_refinement.rb	(revision 56475)
+++ test/ruby/test_refinement.rb	(revision 56476)
@@ -101,6 +101,10 @@ class TestRefinement < Test::Unit::TestC https://github.com/ruby/ruby/blob/trunk/test/ruby/test_refinement.rb#L101
       def self.invoke_call_x_on(foo)
         return foo.call_x
       end
+
+      def self.return_proc(&block)
+        block
+      end
     end
   end
 
@@ -1743,6 +1747,7 @@ class TestRefinement < Test::Unit::TestC https://github.com/ruby/ruby/blob/trunk/test/ruby/test_refinement.rb#L1747
 
   def test_symbol_proc
     assert_equal("FooExt#x", FooExtClient.map_x_on(Foo.new))
+    assert_equal("Foo#x", FooExtClient.return_proc(&:x).(Foo.new))
   end
 
   private

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]