summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-12-19 10:34:13 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-12-19 10:34:13 +0000
commitc3026b723c4af4be56e3297a29d5a21b5d64eecc (patch)
tree500872e0d05c193ba3c921ff44ba91a5f1869d9a /test/ruby
parent542a12d673ee5da8a7b8d40d66415f3e72bb0077 (diff)
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
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_module.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/ruby/test_module.rb b/test/ruby/test_module.rb
index b2e2e8049d..eb1477893b 100644
--- a/test/ruby/test_module.rb
+++ b/test/ruby/test_module.rb
@@ -583,9 +583,18 @@ class TestModule < Test::Unit::TestCase
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