diff options
-rw-r--r-- | src/js_printer.zig | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/js_printer.zig b/src/js_printer.zig index 1a68c6662..945e0a382 100644 --- a/src/js_printer.zig +++ b/src/js_printer.zig @@ -340,8 +340,14 @@ pub fn writeJSONString(text: []const u8, comptime Writer: type, writer: Writer, test "quoteForJSON" { var allocator = default_allocator; - try std.testing.expectEqualStrings("\"I don't need any quotes.\"", try quoteForJSON("I don't need any quotes.", allocator, false)); - try std.testing.expectEqualStrings("\"I need a quote for \\\"this\\\".\"", try quoteForJSON("I need a quote for \"this\".", allocator, false)); + try std.testing.expectEqualStrings( + "\"I don't need any quotes.\"", + (try quoteForJSON("I don't need any quotes.", MutableString.init(allocator, 0) catch unreachable, false)).list.items, + ); + try std.testing.expectEqualStrings( + "\"I need a quote for \\\"this\\\".\"", + (try quoteForJSON("I need a quote for \"this\".", MutableString.init(allocator, 0) catch unreachable, false)).list.items, + ); } pub const SourceMapHandler = struct { |