authorgravatar for marc@tiehu.isMarc Tiehuis <marc@tiehu.is> 2024-03-09 17:03:05+13:00
committergravatar for marc@tiehu.isMarc Tiehuis <marc@tiehu.is> 2024-03-09 17:03:05+13:00
logb6695f0542fc23961da70ca789a5cb79a7ea29d4
tree94f3967375956cef361a9c683ad085df9d7fea3b
parent04fd113e226c82da9aa8e4ca7d63dd8ca1e453b2

std.json: update tests to match new floating point formatting


2 files changed, 7 insertions(+), 7 deletions(-)

lib/std/json/dynamic_test.zig+1-1
...@@ -213,7 +213,7 @@ test "Value.jsonStringify" {...@@ -213,7 +213,7 @@ test "Value.jsonStringify" {
213 \\ true,213 \\ true,
214 \\ 42,214 \\ 42,
215 \\ 43,215 \\ 43,
216 \\ 4.2e+01,216 \\ 4.2e1,
217 \\ "weeee",217 \\ "weeee",
218 \\ [218 \\ [
219 \\ 1,219 \\ 1,
lib/std/json/stringify_test.zig+6-6
...@@ -74,16 +74,16 @@ fn testBasicWriteStream(w: anytype, slice_stream: anytype) !void {...@@ -74,16 +74,16 @@ fn testBasicWriteStream(w: anytype, slice_stream: anytype) !void {
74 \\{74 \\{
75 \\ "object": {75 \\ "object": {
76 \\ "one": 1,76 \\ "one": 1,
77 \\ "two": 2.0e+0077 \\ "two": 2e0
78 \\ },78 \\ },
79 \\ "string": "This is a string",79 \\ "string": "This is a string",
80 \\ "array": [80 \\ "array": [
81 \\ "Another string",81 \\ "Another string",
82 \\ 1,82 \\ 1,
83 \\ 3.5e+0083 \\ 3.5e0
84 \\ ],84 \\ ],
85 \\ "int": 10,85 \\ "int": 10,
86 \\ "float": 3.5e+0086 \\ "float": 3.5e0
87 \\}87 \\}
88 ;88 ;
89 try std.testing.expectEqualStrings(expected, result);89 try std.testing.expectEqualStrings(expected, result);
...@@ -123,12 +123,12 @@ test "stringify basic types" {...@@ -123,12 +123,12 @@ test "stringify basic types" {
123 try testStringify("null", @as(?u8, null), .{});123 try testStringify("null", @as(?u8, null), .{});
124 try testStringify("null", @as(?*u32, null), .{});124 try testStringify("null", @as(?*u32, null), .{});
125 try testStringify("42", 42, .{});125 try testStringify("42", 42, .{});
126 try testStringify("4.2e+01", 42.0, .{});126 try testStringify("4.2e1", 42.0, .{});
127 try testStringify("42", @as(u8, 42), .{});127 try testStringify("42", @as(u8, 42), .{});
128 try testStringify("42", @as(u128, 42), .{});128 try testStringify("42", @as(u128, 42), .{});
129 try testStringify("9999999999999999", 9999999999999999, .{});129 try testStringify("9999999999999999", 9999999999999999, .{});
130 try testStringify("4.2e+01", @as(f32, 42), .{});130 try testStringify("4.2e1", @as(f32, 42), .{});
131 try testStringify("4.2e+01", @as(f64, 42), .{});131 try testStringify("4.2e1", @as(f64, 42), .{});
132 try testStringify("\"ItBroke\"", @as(anyerror, error.ItBroke), .{});132 try testStringify("\"ItBroke\"", @as(anyerror, error.ItBroke), .{});
133 try testStringify("\"ItBroke\"", error.ItBroke, .{});133 try testStringify("\"ItBroke\"", error.ItBroke, .{});
134}134}