mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Fixed the radix for control chars
This commit is contained in:
parent
0a218a97ad
commit
7b4b5e0840
2 changed files with 5 additions and 1 deletions
|
@ -87,7 +87,7 @@ dump_append_string_value(struct dump_config *dc, VALUE obj)
|
|||
break;
|
||||
default:
|
||||
if (c <= 0x1f)
|
||||
dump_append(dc, "\\u%04d", c);
|
||||
dump_append(dc, "\\u%04x", c);
|
||||
else
|
||||
dump_append(dc, "%c", c);
|
||||
}
|
||||
|
|
|
@ -275,6 +275,10 @@ class TestObjSpace < Test::Unit::TestCase
|
|||
JSON.parse(info) if defined?(JSON)
|
||||
end
|
||||
|
||||
def test_dump_control_char
|
||||
assert_include(ObjectSpace.dump("\x0f"), '"value":"\u000f"')
|
||||
end
|
||||
|
||||
def test_dump_special_consts
|
||||
# [ruby-core:69692] [Bug #11291]
|
||||
assert_equal('null', ObjectSpace.dump(nil))
|
||||
|
|
Loading…
Add table
Reference in a new issue