mirror of
https://github.com/ruby/ruby.git
synced 2025-08-24 21:44:30 +02:00
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
This commit is contained in:
parent
e1b592b508
commit
d10451f3fd
2 changed files with 34 additions and 7 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue