diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-07-30 05:24:24 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-07-30 05:24:24 +0000 |
commit | 83940fc310d45010fe452fcf4f6ffbaba0c3f5d6 (patch) | |
tree | 8d370500150868fde259c54214f3ed1a07899794 /test/ruby | |
parent | 48d7aa4ae93265cef0d824abe7815befdb47235e (diff) | |
download | ruby-83940fc310d45010fe452fcf4f6ffbaba0c3f5d6.tar.gz |
variable.c: tmp_classpath
* variable.c: store anonymous class path in tmp_classpath but not in
classpath. [ruby-core:42865][Bug #6078]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36574 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-rw-r--r-- | test/ruby/test_module.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/test/ruby/test_module.rb b/test/ruby/test_module.rb index b27f9ddd0f..2051617aad 100644 --- a/test/ruby/test_module.rb +++ b/test/ruby/test_module.rb @@ -363,6 +363,23 @@ class TestModule < Test::Unit::TestCase assert_equal("TestModule::User", User.name) end + def test_classpath + m = Module.new + n = Module.new + m.const_set(:N, n) + assert_nil(m.name) + assert_nil(n.name) + assert_equal([:N], m.constants) + m.module_eval("module O end") + assert_equal([:N, :O], m.constants) + assert_nil(m::N.name) + assert_match(/\A(?:#<Module:.*>::)?O\z/, m::O.name) + self.class.const_set(:M, m) + prefix = self.class.name + "::M::" + assert_equal(prefix+"N", m.const_get(:N).name) + assert_equal(prefix+"O", m.const_get(:O).name) + end + def test_private_class_method assert_raise(ExpectedException) { AClass.cm1 } assert_raise(ExpectedException) { AClass.cm3 } |