diff options
Diffstat (limited to 'test/ruby/test_module.rb')
-rw-r--r-- | test/ruby/test_module.rb | 9 |
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 |