diff options
author | 2022-07-04 06:03:19 -0700 | |
---|---|---|
committer | 2022-07-04 06:03:19 -0700 | |
commit | eea02d950009fce77cf45a3aaa0d594be7c83bb7 (patch) | |
tree | e4a9f81341d80a92f64b19600c5fdcd9646aa2e2 | |
parent | c7e0ed8e219f3fcedb520762da61115a4809e76c (diff) | |
download | bun-eea02d950009fce77cf45a3aaa0d594be7c83bb7.tar.gz bun-eea02d950009fce77cf45a3aaa0d594be7c83bb7.tar.zst bun-eea02d950009fce77cf45a3aaa0d594be7c83bb7.zip |
[misc] Make that test work
-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 { |