aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-04-08 13:47:37 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-04-08 13:47:37 +0000
commitd10451f3fd51f577e704db770de48d05044eb45c (patch)
treee74a81e11a3f87b21068a3a80d4efbd87981f7f6 /test/ruby
parente1b592b508c72a56ae012869d97fe1580ff87246 (diff)
downloadruby-d10451f3fd51f577e704db770de48d05044eb45c.tar.gz
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
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_module.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/test/ruby/test_module.rb b/test/ruby/test_module.rb
index b1ee7b0944..685118544e 100644
--- a/test/ruby/test_module.rb
+++ b/test/ruby/test_module.rb
@@ -296,6 +296,9 @@ class TestModule < Test::Unit::TestCase
def test_nested_get
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