diff options
author | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-08-11 00:38:53 +0000 |
---|---|---|
committer | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-08-11 00:38:53 +0000 |
commit | 31a5ce34cdc4af831860fea87500f3870b42f90a (patch) | |
tree | cf2fb496fce547cd35a3fa56e4efcad0038cb804 | |
parent | 03f06aa7affc76868bd306b3e521219d6a12b5dd (diff) |
merges r32327 from trunk into ruby_1_9_2.
--
* test/ruby/test_module.rb: tests for [Bug #3422] and [Bug #3423].
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_2@32922 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | test/ruby/test_module.rb | 37 | ||||
-rw-r--r-- | version.h | 2 |
3 files changed, 39 insertions, 4 deletions
@@ -1,3 +1,7 @@ +Thu Jun 30 20:12:36 2011 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * test/ruby/test_module.rb: tests for [Bug #3422] and [Bug #3423]. + Thu Jun 30 12:25:34 2011 Koichi Sasada <ko1@atdot.net> * thread_pthread.c (rb_thread_create_timer_thread): allocate diff --git a/test/ruby/test_module.rb b/test/ruby/test_module.rb index c2084a2e72..1e260641b6 100644 --- a/test/ruby/test_module.rb +++ b/test/ruby/test_module.rb @@ -451,7 +451,7 @@ class TestModule < Test::Unit::TestCase assert_equal(false, o.respond_to?(:bar=)) end - def test_const_get2 + def test_const_get_evaled c1 = Class.new c2 = Class.new(c1) @@ -481,16 +481,47 @@ class TestModule < Test::Unit::TestCase 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') @@ -1,5 +1,5 @@ #define RUBY_VERSION "1.9.2" -#define RUBY_PATCHLEVEL 307 +#define RUBY_PATCHLEVEL 308 #define RUBY_VERSION_MAJOR 1 #define RUBY_VERSION_MINOR 9 #define RUBY_VERSION_TEENY 1 |