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

ruby-changes:20279

From: nobu <ko1@a...>
Date: Thu, 30 Jun 2011 20:13:05 +0900 (JST)
Subject: [ruby-changes:20279] nobu:r32327 (trunk): * test/ruby/test_module.rb: tests for [Bug #3422] and [Bug #3423].

nobu	2011-06-30 20:12:38 +0900 (Thu, 30 Jun 2011)

  New Revision: 32327

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

  Log:
    * test/ruby/test_module.rb: tests for [Bug #3422] and [Bug #3423].

  Modified files:
    trunk/ChangeLog
    trunk/test/ruby/test_module.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 32326)
+++ ChangeLog	(revision 32327)
@@ -1,3 +1,7 @@
+Thu Jun 30 20:12:36 2011  Nobuyoshi Nakada  <nobu@r...>
+
+	* test/ruby/test_module.rb: tests for [Bug #3422] and [Bug #3423].
+
 Thu Jun 30 20:03:39 2011  Tadayoshi Funaba  <tadf@d...>
 
 	* ext/date/date_core.c: modified doc.
@@ -5,15 +9,15 @@
 Thu Jun 30 19:09:19 2011  Koichi Sasada  <ko1@a...>
 
 	* thread_pthread.c (thread_timer): ignore unknown errno.
-	 (we observed that select(2) was canceled by errno=514 on
+	  (we observed that select(2) was canceled by errno=514 on
 	  boron == Linux/Xen environment)
 
 Thu Jun 30 17:33:25 2011  Koichi Sasada  <ko1@a...>
 
-	* ext/objspace/objspace.c (ObjectSpace.count_tdata_objects): 
+	* ext/objspace/objspace.c (ObjectSpace.count_tdata_objects):
 	  Fix rdoc.  Fixes Bug #3892.
 
-	* ext/objspace/objspace.c (ObjectSpace.count_tdata_objects): 
+	* ext/objspace/objspace.c (ObjectSpace.count_tdata_objects):
 	  Change key type if the klass of a object is zero (internal object).
 	  Read rdoc for details.
 
@@ -21,7 +25,7 @@
 
 Thu Jun 30 17:25:08 2011  Koichi Sasada  <ko1@a...>
 
-	* thread_pthread.c (ping_signal_thread_list, thread_timer): 
+	* thread_pthread.c (ping_signal_thread_list, thread_timer):
 	  fix to keep polling state if there are any ping-tasks.
 
 Thu Jun 30 12:25:34 2011  Koichi Sasada  <ko1@a...>
Index: test/ruby/test_module.rb
===================================================================
--- test/ruby/test_module.rb	(revision 32326)
+++ test/ruby/test_module.rb	(revision 32327)
@@ -457,7 +457,7 @@
     assert_equal(false, o.respond_to?(:bar=))
   end
 
-  def test_const_get2
+  def test_const_get_evaled
     c1 = Class.new
     c2 = Class.new(c1)
 
@@ -487,16 +487,47 @@
     assert_raise(NameError) { c1.const_get(:foo) }
   end
 
-  def test_const_set2
+  def test_const_set_invalid_name
     c1 = Class.new
     assert_raise(NameError) { c1.const_set(:foo, :foo) }
   end
 
-  def test_const_get3
+  def test_const_get_invalid_name
     c1 = Class.new
     assert_raise(NameError) { c1.const_defined?(:foo) }
   end
 
+  def test_const_get_no_inherited
+    bug3422 = '[ruby-core:30719]'
+    assert_in_out_err([], <<-INPUT, %w[1 NameError A], [], bug3422)
+    BasicObject::A = 1
+    puts [true, false].map {|inh|
+      begin
+        Object.const_get(:A, inh)
+      rescue NameError => e
+        [e.class, e.name]
+      end
+    }
+    INPUT
+  end
+
+  def test_const_get_inherited
+    bug3423 = '[ruby-core:30720]'
+    assert_in_out_err([], <<-INPUT, %w[NameError A NameError A], [], bug3423)
+    module Foo; A = 1; end
+    class Object; include Foo; end
+    class Bar; include Foo; end
+
+    puts [Object, Bar].map {|klass|
+      begin
+        klass.const_get(:A, false)
+      rescue NameError => e
+        [e.class, e.name]
+      end
+    }
+    INPUT
+  end
+
   def test_class_variable_get
     c = Class.new
     c.class_eval('@@foo = :foo')

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

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