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

ruby-changes:30835

From: nagachika <ko1@a...>
Date: Thu, 12 Sep 2013 01:42:52 +0900 (JST)
Subject: [ruby-changes:30835] nagachika:r42914 (ruby_2_0_0): merge revision(s) 40021, 42380: [Backport #8686]

nagachika	2013-09-12 01:42:43 +0900 (Thu, 12 Sep 2013)

  New Revision: 42914

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=42914

  Log:
    merge revision(s) 40021,42380: [Backport #8686]
    
    test_method.rb: split
    
    * test/ruby/test_method.rb (test_define_method): split for each tests.
    * object.c (rb_class_inherited_p): allow iclasses to be tested for
      inheritance. [Bug #8686] [ruby-core:56174]
    
    * test/ruby/test_method.rb: add test

  Modified directories:
    branches/ruby_2_0_0/
  Modified files:
    branches/ruby_2_0_0/ChangeLog
    branches/ruby_2_0_0/object.c
    branches/ruby_2_0_0/test/ruby/test_method.rb
    branches/ruby_2_0_0/version.h
Index: ruby_2_0_0/ChangeLog
===================================================================
--- ruby_2_0_0/ChangeLog	(revision 42913)
+++ ruby_2_0_0/ChangeLog	(revision 42914)
@@ -1,3 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/ChangeLog#L1
+Thu Sep 12 01:34:07 2013  Charlie Somerville  <charliesome@r...>
+
+	* object.c (rb_class_inherited_p): allow iclasses to be tested for
+	  inheritance. [Bug #8686] [ruby-core:56174]
+
+	* test/ruby/test_method.rb: add test
+
 Thu Sep 12 01:18:44 2013  Michal Rokos  <michal@r...>
 
 	* configure.in (sys/pstat.h): fix missing header check for
Index: ruby_2_0_0/object.c
===================================================================
--- ruby_2_0_0/object.c	(revision 42913)
+++ ruby_2_0_0/object.c	(revision 42914)
@@ -1482,7 +1482,7 @@ rb_class_inherited_p(VALUE mod, VALUE ar https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/object.c#L1482
     VALUE start = mod;
 
     if (mod == arg) return Qtrue;
-    if (!CLASS_OR_MODULE_P(arg)) {
+    if (!CLASS_OR_MODULE_P(arg) && !RB_TYPE_P(arg, T_ICLASS)) {
 	rb_raise(rb_eTypeError, "compared with non class/module");
     }
     arg = RCLASS_ORIGIN(arg);
Index: ruby_2_0_0/version.h
===================================================================
--- ruby_2_0_0/version.h	(revision 42913)
+++ ruby_2_0_0/version.h	(revision 42914)
@@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/version.h#L1
 #define RUBY_VERSION "2.0.0"
 #define RUBY_RELEASE_DATE "2013-09-12"
-#define RUBY_PATCHLEVEL 302
+#define RUBY_PATCHLEVEL 303
 
 #define RUBY_RELEASE_YEAR 2013
 #define RUBY_RELEASE_MONTH 9
Index: ruby_2_0_0/test/ruby/test_method.rb
===================================================================
--- ruby_2_0_0/test/ruby/test_method.rb	(revision 42913)
+++ ruby_2_0_0/test/ruby/test_method.rb	(revision 42914)
@@ -232,7 +232,9 @@ class TestMethod < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/test/ruby/test_method.rb#L232
     assert_raise(TypeError) do
       Class.new.class_eval { define_method(:bar, o.method(:bar)) }
     end
+  end
 
+  def test_define_singleton_method
     o = Object.new
     def o.foo(c)
       c.class_eval { define_method(:foo) }
@@ -252,7 +254,25 @@ class TestMethod < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/test/ruby/test_method.rb#L254
     assert_raise(TypeError) do
       Module.new.module_eval {define_method(:foo, Base.instance_method(:foo))}
     end
+  end
 
+  def test_define_singleton_method_with_extended_method
+    bug8686 = "[ruby-core:56174]"
+
+    m = Module.new do
+      extend self
+
+      def a
+        "a"
+      end
+    end
+
+    assert_nothing_raised do
+      m.define_singleton_method(:a, m.method(:a))
+    end
+  end
+
+  def test_define_method_transplating
     feature4254 = '[ruby-core:34267]'
     m = Module.new {define_method(:meth, M.instance_method(:meth))}
     assert_equal(:meth, Object.new.extend(m).meth, feature4254)

Property changes on: ruby_2_0_0
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r40021,42380


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

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