1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Also escape DEL code

This commit is contained in:
Nobuyoshi Nakada 2020-08-17 22:36:48 +09:00
parent 7b4b5e0840
commit 27f7b047e0
No known key found for this signature in database
GPG key ID: 7CD2805BFA3770C6
2 changed files with 4 additions and 0 deletions

View file

@ -85,6 +85,9 @@ dump_append_string_value(struct dump_config *dc, VALUE obj)
case '\r':
dump_append(dc, "\\r");
break;
case '\177':
dump_append(dc, "\\u007f");
break;
default:
if (c <= 0x1f)
dump_append(dc, "\\u%04x", c);

View file

@ -277,6 +277,7 @@ class TestObjSpace < Test::Unit::TestCase
def test_dump_control_char
assert_include(ObjectSpace.dump("\x0f"), '"value":"\u000f"')
assert_include(ObjectSpace.dump("\C-?"), '"value":"\u007f"')
end
def test_dump_special_consts