summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-12-09 12:06:38 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-12-09 12:06:38 +0000
commit15eba4ed0ebb4e019a037b0af10b34fdbc85e03a (patch)
treefef75b1601d2a103614b603d7dd97d4ad84aaf4a /test
parent3c7e764d495ec1ab2498853174f81e975b5be8c8 (diff)
merge revision(s) e1b592b508c72a56ae012869d97fe1580ff87246,d10451f3fd51f577e704db770de48d05044eb45c: [Backport #15758]
test_module.rb: fix a typo * test/ruby/test_module.rb (TestModule#test_nested_get): fix a typo. nested module's name is a qualified path. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67471 b2dd03c8-39d4-4d8f-98ff-823fe69b080e object.c: fix searching nested const paths * object.c (rb_mod_const_get, rb_mod_const_defined): nested const paths should not search from toplevel constants. [ruby-core:92202] [Bug #15758] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67472 b2dd03c8-39d4-4d8f-98ff-823fe69b080e git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_6@67830 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_module.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/test/ruby/test_module.rb b/test/ruby/test_module.rb
index 9e9eb13fba..ef78475424 100644
--- a/test/ruby/test_module.rb
+++ b/test/ruby/test_module.rb
@@ -294,8 +294,11 @@ class TestModule < Test::Unit::TestCase
end
def test_nested_get
- assert_equal Other, Object.const_get([self.class, Other].join('::'))
+ assert_equal Other, Object.const_get([self.class, 'Other'].join('::'))
assert_equal User::USER, self.class.const_get([User, 'USER'].join('::'))
+ assert_raise(NameError) {
+ Object.const_get([self.class.name, 'String'].join('::'))
+ }
end
def test_nested_get_symbol
@@ -328,6 +331,7 @@ class TestModule < Test::Unit::TestCase
assert_send([Object, :const_defined?, [self.class.name, 'Other'].join('::')])
assert_send([self.class, :const_defined?, 'User::USER'])
assert_not_send([self.class, :const_defined?, 'User::Foo'])
+ assert_not_send([Object, :const_defined?, [self.class.name, 'String'].join('::')])
end
def test_nested_defined_symbol