std.json: josh review fixes

* renamed enum_big_numbers_quoted option to enum_nonportable_numbers_as_strings
* updated stringify doc to mention the option

I also reversed the logic to determine whether an integer is nonportable,
it seemed easier to reason about.

I also took a stab at applying the new option to floats, but, I got stuck
at trying to print large floats, not sure if Zig supports that yet.
This commit is contained in:
Jonathan Marler
2023-08-06 09:25:21 -06:00
parent 1cce539ddc
commit 2046880de8
2 changed files with 8 additions and 8 deletions

View File

@@ -434,7 +434,7 @@ test "print" {
try std.testing.expectEqualStrings(expected, result);
}
test "big integers" {
test "nonportable numbers" {
try testStringify("9999999999999999", 9999999999999999, .{});
try testStringify("\"9999999999999999\"", 9999999999999999, .{ .emit_big_numbers_quoted = true });
try testStringify("\"9999999999999999\"", 9999999999999999, .{ .emit_nonportable_numbers_as_strings = true });
}