internal.h: quote unprintable

* internal.h (QUOTE, QUOTE_ID): quote unprintable chars in strings and
  IDs. [Bug #7574] [ruby-dev:46749]
* string.c (rb_str_quote_unprintable): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38558 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2012-12-22 15:04:57 +00:00
parent 1df33a4a5f
commit 6f02547d83
9 changed files with 168 additions and 96 deletions

View file

@ -588,7 +588,9 @@ class TestModule < Test::Unit::TestCase
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") }
bug7574 = '[ruby-dev:46749]'
e = assert_raise(NameError) { Object.const_get("String\0") }
assert_equal("wrong constant name \"String\\0\"", e.message, bug7574)
end
def test_const_defined_invalid_name
@ -596,7 +598,9 @@ class TestModule < Test::Unit::TestCase
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") }
bug7574 = '[ruby-dev:46749]'
e = assert_raise(NameError) { Object.const_defined?("String\0") }
assert_equal("wrong constant name \"String\\0\"", e.message, bug7574)
end
def test_const_get_no_inherited