authorgravatar for Auguste.rame@gmail.comAuguste Rame <Auguste.rame@gmail.com> 2020-04-27 12:22:43-04:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2020-04-27 12:22:43-04:00
log0df82889cf01757f2c19f841a5e3446a5ba70eac
tree7fd4da55d660eede37e4f7441ca18f4e133bcb9e
parenta17eb15e115dd104f4b0bf2b1db04c06432da324
signaturebadge-question-mark Signed by PGP key 4AEE18F83AFDEB23

Fix issue with std.json incorrectly replacing forward slashes with a backslash (#5167)

* fix breaking typo in json.zig * add tests

1 files changed, 3 insertions(+), 1 deletions(-)

lib/std/json.zig+3-1
......@@ -2520,7 +2520,7 @@ pub fn stringify(
25202520 if (options.string.String.escape_solidus) {
25212521 try out_stream.writeAll("\\/");
25222522 } else {
2523 try out_stream.writeByte('\\');
2523 try out_stream.writeByte('/');
25242524 }
25252525 },
25262526 // control characters with short escapes
......@@ -2670,6 +2670,8 @@ test "stringify string" {
26702670 try teststringify("\"with unicode\\ud800\\udc00\"", "with unicode\u{10000}", StringifyOptions{ .string = .{ .String = .{ .escape_unicode = true } } });
26712671 try teststringify("\"with unicode\u{10FFFF}\"", "with unicode\u{10FFFF}", StringifyOptions{});
26722672 try teststringify("\"with unicode\\udbff\\udfff\"", "with unicode\u{10FFFF}", StringifyOptions{ .string = .{ .String = .{ .escape_unicode = true } } });
2673 try teststringify("\"/\"", "/", StringifyOptions{});
2674 try teststringify("\"\\/\"", "/", StringifyOptions{ .string = .{ .String = .{ .escape_solidus = true } } });
26732675}
26742676
26752677test "stringify tagged unions" {