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

ruby-changes:44357

From: nobu <ko1@a...>
Date: Sun, 16 Oct 2016 07:59:53 +0900 (JST)
Subject: [ruby-changes:44357] nobu:r56431 (trunk): test_refinement.rb: test_symbol_proc

nobu	2016-10-16 07:59:39 +0900 (Sun, 16 Oct 2016)

  New Revision: 56431

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

  Log:
    test_refinement.rb: test_symbol_proc
    
    * test/ruby/test_refinement.rb (test_symbol_proc): move from
      test_symbol.rb  [Feature #9451]

  Modified files:
    trunk/test/ruby/test_refinement.rb
    trunk/test/ruby/test_symbol.rb
Index: test/ruby/test_refinement.rb
===================================================================
--- test/ruby/test_refinement.rb	(revision 56430)
+++ test/ruby/test_refinement.rb	(revision 56431)
@@ -74,6 +74,10 @@ class TestRefinement < Test::Unit::TestC https://github.com/ruby/ruby/blob/trunk/test/ruby/test_refinement.rb#L74
     using TestRefinement::FooExt
 
     begin
+      def self.map_x_on(foo)
+        [foo].map(&:x)[0]
+      end
+
       def self.invoke_x_on(foo)
         return foo.x
       end
@@ -1737,6 +1741,10 @@ class TestRefinement < Test::Unit::TestC https://github.com/ruby/ruby/blob/trunk/test/ruby/test_refinement.rb#L1741
     INPUT
   end
 
+  def test_symbol_proc
+    assert_equal("FooExt#x", FooExtClient.map_x_on(Foo.new))
+  end
+
   private
 
   def eval_using(mod, s)
Index: test/ruby/test_symbol.rb
===================================================================
--- test/ruby/test_symbol.rb	(revision 56430)
+++ test/ruby/test_symbol.rb	(revision 56431)
@@ -435,16 +435,4 @@ class TestSymbol < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_symbol.rb#L435
     assert_equal str, str.to_sym.to_s
     assert_not_predicate(str, :frozen?, bug11721)
   end
-
-  module WithRefinements
-    using Module.new {refine(Integer) {alias inc succ}}
-    def mapinc(a)
-      a.map(&:inc)
-    end
-  end
-
-  def test_proc_with_refinements
-    obj = Object.new.extend WithRefinements
-    assert_equal [*1..3], obj.mapinc(0..2)
-  end
 end

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

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