mirror of
https://github.com/ruby/ruby.git
synced 2025-09-23 20:44:00 +02:00
object.c: nul in const name
* object.c (rb_mod_const_get): nul byte is invalid as constant name. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38466 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
542a12d673
commit
c3026b723c
3 changed files with 17 additions and 3 deletions
|
@ -582,10 +582,19 @@ class TestModule < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_const_get_invalid_name
|
||||
c1 = Class.new
|
||||
assert_raise(NameError) { c1.const_get(:foo) }
|
||||
bug5084 = '[ruby-dev:44200]'
|
||||
assert_raise(TypeError, bug5084) { c1.const_get(1) }
|
||||
assert_raise(NameError) { Object.const_get("String\0") }
|
||||
end
|
||||
|
||||
def test_const_defined_invalid_name
|
||||
c1 = Class.new
|
||||
assert_raise(NameError) { c1.const_defined?(:foo) }
|
||||
bug5084 = '[ruby-dev:44200]'
|
||||
assert_raise(TypeError, bug5084) { c1.const_defined?(1) }
|
||||
assert_raise(NameError) { Object.const_defined?("String\0") }
|
||||
end
|
||||
|
||||
def test_const_get_no_inherited
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue