object.c: check more strictly

* object.c (rb_mod_const_get): check more strictly.  [ruby-dev:46748]
  [Bug #7573]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38551 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2012-12-22 10:26:40 +00:00
parent 6a35c26b2d
commit af1ca4cb13
3 changed files with 11 additions and 5 deletions

View file

@ -246,8 +246,9 @@ class TestModule < Test::Unit::TestCase
":Object",
"",
":",
].each do |name|
e = assert_raises(NameError) {
["String::", "[Bug #7573]"],
].each do |name, msg|
e = assert_raises(NameError, "#{msg}#{': ' if msg}wrong constant name #{name.dump}") {
Object.const_get name
}
assert_equal("wrong constant name %s" % name, e.message)