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

ruby-changes:44495

From: shugo <ko1@a...>
Date: Sat, 5 Nov 2016 11:57:44 +0900 (JST)
Subject: [ruby-changes:44495] shugo:r56568 (trunk): * test/ruby/test_refinement.rb (test_refine_alias_in_subclass):

shugo	2016-11-05 11:57:40 +0900 (Sat, 05 Nov 2016)

  New Revision: 56568

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

  Log:
    * test/ruby/test_refinement.rb (test_refine_alias_in_subclass):
      add a test to check that alias in subclasses can be refined.
      [ruby-core:69374] [Bug #11186]

  Modified files:
    trunk/ChangeLog
    trunk/test/ruby/test_refinement.rb
Index: test/ruby/test_refinement.rb
===================================================================
--- test/ruby/test_refinement.rb	(revision 56567)
+++ test/ruby/test_refinement.rb	(revision 56568)
@@ -1750,6 +1750,31 @@ class TestRefinement < Test::Unit::TestC https://github.com/ruby/ruby/blob/trunk/test/ruby/test_refinement.rb#L1750
     assert_equal("Foo#x", FooExtClient.return_proc(&:x).(Foo.new))
   end
 
+  module AliasInSubclass
+    class C
+      def foo
+        :original
+      end
+    end
+
+    class D < C
+      alias bar foo
+    end
+
+    module M
+      refine D do
+        def bar
+          :refined
+        end
+      end
+    end
+  end
+
+  def test_refine_alias_in_subclass
+    assert_equal(:refined,
+                 eval_using(AliasInSubclass::M, "AliasInSubclass::D.new.bar"))
+  end
+
   private
 
   def eval_using(mod, s)
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 56567)
+++ ChangeLog	(revision 56568)
@@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Sat Nov  5 11:53:02 2016  Shugo Maeda  <shugo@r...>
+
+	* test/ruby/test_refinement.rb (test_refine_alias_in_subclass):
+	  add a test to check that alias in subclasses can be refined.
+	  [ruby-core:69374] [Bug #11186]
+
 Sat Nov  5 11:20:57 2016  Shugo Maeda  <shugo@r...>
 
 	* cont.c (cont_new): disable optimization if clang's version is

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

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