authorgravatar for mason@gamesbymason.comMason Remaley <mason@gamesbymason.com> 2026-09-27 03:48:48-07:00
committergravatar for mason@gamesbymason.comMason Remaley <mason@gamesbymason.com> 2026-09-27 04:13:48-07:00
log9cbd85b3410952b1f931849044f707222df52270
treeeb1c376d022f393a4c64b5b2b71670ad77f8a5b5
parentb80b26c0eaafa8d028aea72a56e9bd1c19d42b32

Fix tests, remove error arg from formatters


1 files changed, 135 insertions(+), 229 deletions(-)

lib/std/zon/parse.zig+135-229
......@@ -98,12 +98,8 @@ pub const Errors = struct {
9898 pub const empty: Errors = .{ .items = &.{} };
9999
100100 /// Log the failure with `std.log.err`.
101 pub fn log(
102 self: *const Errors,
103 path: []const u8,
104 err: error{ OutOfMemory, ParseZon },
105 ) void {
106 std.log.err("{f}", .{self.fmt(path, err)});
101 pub fn log(self: *const Errors, path: []const u8) void {
102 std.log.err("{f}", .{self.fmt(path)});
107103 }
108104
109105 test log {
......@@ -123,20 +119,19 @@ pub const Errors = struct {
123119 .arena = arena,
124120 .source = ".{ .foo = 1, .bar = 2 }",
125121 .errors = &errors,
126 }) catch |err| b: {
127 errors.log("input.zon", err);
128 break :b .{ .foo = 0, .bar = 0 };
122 }) catch |err| switch (err) {
123 error.OutOfMemory => return error.OutOfMemory,
124 error.ParseZon => b: {
125 errors.log("input.zon");
126 break :b .{ .foo = 0, .bar = 0 };
127 },
129128 };
130129 _ = parsed;
131130 }
132131
133132 /// Log the failure with `std.log.err`, and then terminate the process with exit code 1.
134 pub fn fatal(
135 self: *const Errors,
136 path: []const u8,
137 err: error{ OutOfMemory, ParseZon },
138 ) noreturn {
139 std.process.fatal("{f}", .{self.fmt(path, err)});
133 pub fn fatal(self: *const Errors, path: []const u8) noreturn {
134 std.process.fatal("{f}", .{self.fmt(path)});
140135 }
141136
142137 test fatal {
......@@ -156,29 +151,25 @@ pub const Errors = struct {
156151 .arena = arena,
157152 .source = ".{ .foo = 1, .bar = 2 }",
158153 .errors = &errors,
159 }) catch |err| errors.fatal("input.zon", err);
154 }) catch |err| switch (err) {
155 error.OutOfMemory => return error.OutOfMemory,
156 error.ParseZon => errors.fatal("input.zon"),
157 };
160158 _ = parsed;
161159 }
162160
163 pub fn fmt(
164 self: *const Errors,
165 path: []const u8,
166 err: error{ OutOfMemory, ParseZon },
167 ) Formatter {
161 pub fn fmt(self: *const Errors, path: []const u8) Formatter {
168162 return .{
169163 .items = self.items,
170164 .path = path,
171 .err = err,
172165 };
173166 }
174167
175168 pub const Formatter = struct {
176169 path: []const u8,
177170 items: []const Error,
178 err: error{ OutOfMemory, ParseZon },
179171
180172 pub fn format(self: *const @This(), w: *std.Io.Writer) std.Io.Writer.Error!void {
181 try w.print("{s}: {}\n", .{ self.path, self.err });
182173 for (self.items) |e| {
183174 try w.print("{s}:", .{self.path});
184175 try w.print("{d}:{d}: error: {s}\n", .{
......@@ -247,9 +238,12 @@ test fromSlice {
247238 .arena = arena,
248239 .source = source,
249240 .errors = &errors,
250 }) catch |err| {
251 errors.log("texture_options.zon", err);
252 return err;
241 }) catch |err| switch (err) {
242 error.OutOfMemory => return err,
243 error.ParseZon => {
244 errors.log("texture_options.zon");
245 return err;
246 },
253247 };
254248
255249 try std.testing.expectEqualDeep(TextureOptions{
......@@ -319,18 +313,24 @@ test updateFromSlice {
319313 .arena = arena,
320314 .source = global_config,
321315 .errors = &errors,
322 }) catch |err| {
323 errors.log("global_config.zon", err);
324 return err;
316 }) catch |err| switch (err) {
317 error.OutOfMemory => return err,
318 error.ParseZon => {
319 errors.log("global_config.zon");
320 return err;
321 },
325322 };
326323 updateFromSlice(MyTextEditorConfig, &config, .{
327324 .gpa = gpa,
328325 .arena = arena,
329326 .source = project_config,
330327 .errors = &errors,
331 }) catch |err| {
332 errors.log("project_config.zon", err);
333 return err;
328 }) catch |err| switch (err) {
329 error.OutOfMemory => return err,
330 error.ParseZon => {
331 errors.log("project_config.zon");
332 return err;
333 },
334334 };
335335
336336 try std.testing.expectEqualDeep(MyTextEditorConfig{
......@@ -1395,10 +1395,9 @@ test "std.zon ast errors" {
13951395 }),
13961396 );
13971397 try std.testing.expectFmt(
1398 \\input.zon: error.ParseZon
13991398 \\input.zon:1:13: error: expected ',' after initializer
14001399 \\
1401 , "{f}", .{errors.fmt("input.zon", error.ParseZon)});
1400 , "{f}", .{errors.fmt("input.zon")});
14021401}
14031402
14041403test "std.zon comments" {
......@@ -1431,10 +1430,9 @@ test "std.zon comments" {
14311430 .errors = &errors,
14321431 }));
14331432 try std.testing.expectFmt(
1434 \\input.zon: error.ParseZon
14351433 \\input.zon:1:1: error: expected expression, found 'a document comment'
14361434 \\
1437 , "{f}", .{errors.fmt("input.zon", error.ParseZon)});
1435 , "{f}", .{errors.fmt("input.zon")});
14381436 }
14391437}
14401438
......@@ -1452,9 +1450,8 @@ test "std.zon failure/oom formatting" {
14521450 .errors = &errors,
14531451 }));
14541452 try std.testing.expectFmt(
1455 \\input.zon: error.ParseZon
14561453 \\
1457 , "{f}", .{errors.fmt("input.zon", error.ParseZon)});
1454 , "{f}", .{errors.fmt("input.zon")});
14581455}
14591456
14601457test "std.zon fromSlice syntax error" {
......@@ -1472,6 +1469,10 @@ test "std.zon fromSlice syntax error" {
14721469 .errors = &errors,
14731470 }),
14741471 );
1472 try std.testing.expectFmt(
1473 \\input.zon:1:3: error: expected expression, found 'EOF'
1474 \\
1475 , "{f}", .{errors.fmt("input.zon")});
14751476}
14761477
14771478test "std.zon optional" {
......@@ -1609,11 +1610,10 @@ test "std.zon unions" {
16091610 }),
16101611 );
16111612 try std.testing.expectFmt(
1612 \\input.zon: error.ParseZon
16131613 \\input.zon:1:4: error: unexpected field 'z'
16141614 \\input.zon:1:4: note: supported: 'x', 'y'
16151615 \\
1616 , "{f}", .{errors.fmt("input.zon", error.ParseZon)});
1616 , "{f}", .{errors.fmt("input.zon")});
16171617 }
16181618
16191619 // Explicit void field
......@@ -1629,10 +1629,9 @@ test "std.zon unions" {
16291629 }),
16301630 );
16311631 try std.testing.expectFmt(
1632 \\input.zon: error.ParseZon
16331632 \\input.zon:1:6: error: expected type 'void'
16341633 \\
1635 , "{f}", .{errors.fmt("input.zon", error.ParseZon)});
1634 , "{f}", .{errors.fmt("input.zon")});
16361635 }
16371636
16381637 // Extra field
......@@ -1648,10 +1647,9 @@ test "std.zon unions" {
16481647 }),
16491648 );
16501649 try std.testing.expectFmt(
1651 \\input.zon: error.ParseZon
16521650 \\input.zon:1:2: error: expected union
16531651 \\
1654 , "{f}", .{errors.fmt("input.zon", error.ParseZon)});
1652 , "{f}", .{errors.fmt("input.zon")});
16551653 }
16561654
16571655 // No fields
......@@ -1667,10 +1665,9 @@ test "std.zon unions" {
16671665 }),
16681666 );
16691667 try std.testing.expectFmt(
1670 \\input.zon: error.ParseZon
16711668 \\input.zon:1:2: error: expected union
16721669 \\
1673 , "{f}", .{errors.fmt("input.zon", error.ParseZon)});
1670 , "{f}", .{errors.fmt("input.zon")});
16741671 }
16751672
16761673 // Enum literals cannot coerce into untagged unions
......@@ -1683,10 +1680,9 @@ test "std.zon unions" {
16831680 .errors = &errors,
16841681 }));
16851682 try std.testing.expectFmt(
1686 \\input.zon: error.ParseZon
16871683 \\input.zon:1:2: error: expected union
16881684 \\
1689 , "{f}", .{errors.fmt("input.zon", error.ParseZon)});
1685 , "{f}", .{errors.fmt("input.zon")});
16901686 }
16911687
16921688 // Unknown field for enum literal coercion
......@@ -1699,11 +1695,10 @@ test "std.zon unions" {
16991695 .errors = &errors,
17001696 }));
17011697 try std.testing.expectFmt(
1702 \\input.zon: error.ParseZon
17031698 \\input.zon:1:2: error: unexpected field 'y'
17041699 \\input.zon:1:2: note: supported: 'x'
17051700 \\
1706 , "{f}", .{errors.fmt("input.zon", error.ParseZon)});
1701 , "{f}", .{errors.fmt("input.zon")});
17071702 }
17081703
17091704 // Non void field for enum literal coercion
......@@ -1716,10 +1711,9 @@ test "std.zon unions" {
17161711 .errors = &errors,
17171712 }));
17181713 try std.testing.expectFmt(
1719 \\input.zon: error.ParseZon
17201714 \\input.zon:1:2: error: expected union
17211715 \\
1722 , "{f}", .{errors.fmt("input.zon", error.ParseZon)});
1716 , "{f}", .{errors.fmt("input.zon")});
17231717 }
17241718}
17251719
......@@ -1796,11 +1790,10 @@ test "std.zon structs" {
17961790 }),
17971791 );
17981792 try std.testing.expectFmt(
1799 \\input.zon: error.ParseZon
18001793 \\input.zon:1:12: error: unexpected field 'z'
18011794 \\input.zon:1:12: note: supported: 'x', 'y'
18021795 \\
1803 , "{f}", .{errors.fmt("input.zon", error.ParseZon)});
1796 , "{f}", .{errors.fmt("input.zon")});
18041797 }
18051798
18061799 // Duplicate field
......@@ -1816,11 +1809,10 @@ test "std.zon structs" {
18161809 }),
18171810 );
18181811 try std.testing.expectFmt(
1819 \\input.zon: error.ParseZon
18201812 \\input.zon:1:4: error: duplicate struct field name
18211813 \\input.zon:1:12: note: duplicate name here
18221814 \\
1823 , "{f}", .{errors.fmt("input.zon", error.ParseZon)});
1815 , "{f}", .{errors.fmt("input.zon")});
18241816 }
18251817
18261818 // Ignore unknown fields
......@@ -1849,11 +1841,10 @@ test "std.zon structs" {
18491841 }),
18501842 );
18511843 try std.testing.expectFmt(
1852 \\input.zon: error.ParseZon
18531844 \\input.zon:1:4: error: unexpected field 'x'
18541845 \\input.zon:1:4: note: none expected
18551846 \\
1856 , "{f}", .{errors.fmt("input.zon", error.ParseZon)});
1847 , "{f}", .{errors.fmt("input.zon")});
18571848 }
18581849
18591850 // Missing field
......@@ -1869,10 +1860,9 @@ test "std.zon structs" {
18691860 }),
18701861 );
18711862 try std.testing.expectFmt(
1872 \\input.zon: error.ParseZon
18731863 \\input.zon:1:2: error: missing required field y
18741864 \\
1875 , "{f}", .{errors.fmt("input.zon", error.ParseZon)});
1865 , "{f}", .{errors.fmt("input.zon")});
18761866 }
18771867
18781868 // Default field
......@@ -1910,10 +1900,9 @@ test "std.zon structs" {
19101900 });
19111901 try std.testing.expectError(error.ParseZon, parsed);
19121902 try std.testing.expectFmt(
1913 \\input.zon: error.ParseZon
19141903 \\input.zon:1:18: error: cannot initialize comptime field
19151904 \\
1916 , "{f}", .{errors.fmt("input.zon", error.ParseZon)});
1905 , "{f}", .{errors.fmt("input.zon")});
19171906 }
19181907
19191908 // Enum field (regression test, we were previously getting the field name in an
......@@ -1953,11 +1942,10 @@ test "std.zon structs" {
19531942 });
19541943 try std.testing.expectError(error.ParseZon, parsed);
19551944 try std.testing.expectFmt(
1956 \\input.zon: error.ParseZon
19571945 \\input.zon:1:1: error: types are not available in ZON
19581946 \\input.zon:1:1: note: replace the type with '.'
19591947 \\
1960 , "{f}", .{errors.fmt("input.zon", error.ParseZon)});
1948 , "{f}", .{errors.fmt("input.zon")});
19611949 }
19621950
19631951 // Arrays
......@@ -1970,11 +1958,10 @@ test "std.zon structs" {
19701958 });
19711959 try std.testing.expectError(error.ParseZon, parsed);
19721960 try std.testing.expectFmt(
1973 \\input.zon: error.ParseZon
19741961 \\input.zon:1:1: error: types are not available in ZON
19751962 \\input.zon:1:1: note: replace the type with '.'
19761963 \\
1977 , "{f}", .{errors.fmt("input.zon", error.ParseZon)});
1964 , "{f}", .{errors.fmt("input.zon")});
19781965 }
19791966
19801967 // Slices
......@@ -1987,11 +1974,10 @@ test "std.zon structs" {
19871974 });
19881975 try std.testing.expectError(error.ParseZon, parsed);
19891976 try std.testing.expectFmt(
1990 \\input.zon: error.ParseZon
19911977 \\input.zon:1:1: error: types are not available in ZON
19921978 \\input.zon:1:1: note: replace the type with '.'
19931979 \\
1994 , "{f}", .{errors.fmt("input.zon", error.ParseZon)});
1980 , "{f}", .{errors.fmt("input.zon")});
19951981 }
19961982
19971983 // Tuples
......@@ -2004,11 +1990,10 @@ test "std.zon structs" {
20041990 });
20051991 try std.testing.expectError(error.ParseZon, parsed);
20061992 try std.testing.expectFmt(
2007 \\input.zon: error.ParseZon
20081993 \\input.zon:1:1: error: types are not available in ZON
20091994 \\input.zon:1:1: note: replace the type with '.'
20101995 \\
2011 , "{f}", .{errors.fmt("input.zon", error.ParseZon)});
1996 , "{f}", .{errors.fmt("input.zon")});
20121997 }
20131998
20141999 // Nested
......@@ -2021,11 +2006,10 @@ test "std.zon structs" {
20212006 });
20222007 try std.testing.expectError(error.ParseZon, parsed);
20232008 try std.testing.expectFmt(
2024 \\input.zon: error.ParseZon
20252009 \\input.zon:1:9: error: types are not available in ZON
20262010 \\input.zon:1:9: note: replace the type with '.'
20272011 \\
2028 , "{f}", .{errors.fmt("input.zon", error.ParseZon)});
2012 , "{f}", .{errors.fmt("input.zon")});
20292013 }
20302014 }
20312015}
......@@ -2102,10 +2086,9 @@ test "std.zon tuples" {
21022086 }),
21032087 );
21042088 try std.testing.expectFmt(
2105 \\input.zon: error.ParseZon
21062089 \\input.zon:1:14: error: index 2 outside of tuple length 2
21072090 \\
2108 , "{f}", .{errors.fmt("input.zon", error.ParseZon)});
2091 , "{f}", .{errors.fmt("input.zon")});
21092092 }
21102093
21112094 // Extra field
......@@ -2121,10 +2104,9 @@ test "std.zon tuples" {
21212104 }),
21222105 );
21232106 try std.testing.expectFmt(
2124 \\input.zon: error.ParseZon
21252107 \\input.zon:1:2: error: missing tuple field with index 1
21262108 \\
2127 , "{f}", .{errors.fmt("input.zon", error.ParseZon)});
2109 , "{f}", .{errors.fmt("input.zon")});
21282110 }
21292111
21302112 // Tuple with unexpected field names
......@@ -2140,10 +2122,9 @@ test "std.zon tuples" {
21402122 }),
21412123 );
21422124 try std.testing.expectFmt(
2143 \\input.zon: error.ParseZon
21442125 \\input.zon:1:2: error: expected tuple
21452126 \\
2146 , "{f}", .{errors.fmt("input.zon", error.ParseZon)});
2127 , "{f}", .{errors.fmt("input.zon")});
21472128 }
21482129
21492130 // Struct with missing field names
......@@ -2159,10 +2140,9 @@ test "std.zon tuples" {
21592140 }),
21602141 );
21612142 try std.testing.expectFmt(
2162 \\input.zon: error.ParseZon
21632143 \\input.zon:1:2: error: expected struct
21642144 \\
2165 , "{f}", .{errors.fmt("input.zon", error.ParseZon)});
2145 , "{f}", .{errors.fmt("input.zon")});
21662146 }
21672147
21682148 // Comptime field
......@@ -2188,10 +2168,9 @@ test "std.zon tuples" {
21882168 });
21892169 try std.testing.expectError(error.ParseZon, parsed);
21902170 try std.testing.expectFmt(
2191 \\input.zon: error.ParseZon
21922171 \\input.zon:1:9: error: cannot initialize comptime field
21932172 \\
2194 , "{f}", .{errors.fmt("input.zon", error.ParseZon)});
2173 , "{f}", .{errors.fmt("input.zon")});
21952174 }
21962175}
21972176
......@@ -2378,10 +2357,9 @@ test "std.zon arrays and slices" {
23782357 }),
23792358 );
23802359 try std.testing.expectFmt(
2381 \\input.zon: error.ParseZon
23822360 \\input.zon:1:3: error: index 0 outside of array of length 0
23832361 \\
2384 , "{f}", .{errors.fmt("input.zon", error.ParseZon)});
2362 , "{f}", .{errors.fmt("input.zon")});
23852363 }
23862364
23872365 // Expect 1 find 2
......@@ -2396,10 +2374,9 @@ test "std.zon arrays and slices" {
23962374 }),
23972375 );
23982376 try std.testing.expectFmt(
2399 \\input.zon: error.ParseZon
24002377 \\input.zon:1:8: error: index 1 outside of array of length 1
24012378 \\
2402 , "{f}", .{errors.fmt("input.zon", error.ParseZon)});
2379 , "{f}", .{errors.fmt("input.zon")});
24032380 }
24042381
24052382 // Expect 2 find 1
......@@ -2414,10 +2391,9 @@ test "std.zon arrays and slices" {
24142391 }),
24152392 );
24162393 try std.testing.expectFmt(
2417 \\input.zon: error.ParseZon
24182394 \\input.zon:1:2: error: expected 2 array elements; found 1
24192395 \\
2420 , "{f}", .{errors.fmt("input.zon", error.ParseZon)});
2396 , "{f}", .{errors.fmt("input.zon")});
24212397 }
24222398
24232399 // Expect 3 find 0
......@@ -2432,10 +2408,9 @@ test "std.zon arrays and slices" {
24322408 }),
24332409 );
24342410 try std.testing.expectFmt(
2435 \\input.zon: error.ParseZon
24362411 \\input.zon:1:2: error: expected 3 array elements; found 0
24372412 \\
2438 , "{f}", .{errors.fmt("input.zon", error.ParseZon)});
2413 , "{f}", .{errors.fmt("input.zon")});
24392414 }
24402415
24412416 // Wrong inner type
......@@ -2452,10 +2427,9 @@ test "std.zon arrays and slices" {
24522427 }),
24532428 );
24542429 try std.testing.expectFmt(
2455 \\input.zon: error.ParseZon
24562430 \\input.zon:1:3: error: expected type 'bool'
24572431 \\
2458 , "{f}", .{errors.fmt("input.zon", error.ParseZon)});
2432 , "{f}", .{errors.fmt("input.zon")});
24592433 }
24602434
24612435 // Slice
......@@ -2470,10 +2444,9 @@ test "std.zon arrays and slices" {
24702444 }),
24712445 );
24722446 try std.testing.expectFmt(
2473 \\input.zon: error.ParseZon
24742447 \\input.zon:1:3: error: expected type 'bool'
24752448 \\
2476 , "{f}", .{errors.fmt("input.zon", error.ParseZon)});
2449 , "{f}", .{errors.fmt("input.zon")});
24772450 }
24782451 }
24792452
......@@ -2491,10 +2464,9 @@ test "std.zon arrays and slices" {
24912464 }),
24922465 );
24932466 try std.testing.expectFmt(
2494 \\input.zon: error.ParseZon
24952467 \\input.zon:1:1: error: expected array
24962468 \\
2497 , "{f}", .{errors.fmt("input.zon", error.ParseZon)});
2469 , "{f}", .{errors.fmt("input.zon")});
24982470 }
24992471
25002472 // Slice
......@@ -2504,10 +2476,9 @@ test "std.zon arrays and slices" {
25042476 fromSlice([]u8, .{ .gpa = gpa, .arena = arena, .source = "'a'", .errors = &errors }),
25052477 );
25062478 try std.testing.expectFmt(
2507 \\input.zon: error.ParseZon
25082479 \\input.zon:1:1: error: expected array
25092480 \\
2510 , "{f}", .{errors.fmt("input.zon", error.ParseZon)});
2481 , "{f}", .{errors.fmt("input.zon")});
25112482 }
25122483 }
25132484
......@@ -2518,10 +2489,9 @@ test "std.zon arrays and slices" {
25182489 fromSlice([]u8, .{ .gpa = gpa, .arena = arena, .source = " &.{'a', 'b', 'c'}", .errors = &errors }),
25192490 );
25202491 try std.testing.expectFmt(
2521 \\input.zon: error.ParseZon
25222492 \\input.zon:1:3: error: pointers are not available in ZON
25232493 \\
2524 , "{f}", .{errors.fmt("input.zon", error.ParseZon)});
2494 , "{f}", .{errors.fmt("input.zon")});
25252495 }
25262496}
25272497
......@@ -2573,10 +2543,9 @@ test "std.zon string literal" {
25732543 fromSlice([]u8, .{ .gpa = gpa, .arena = arena, .source = "\"abcd\"", .errors = &errors }),
25742544 );
25752545 try std.testing.expectFmt(
2576 \\input.zon: error.ParseZon
25772546 \\input.zon:1:1: error: expected array
25782547 \\
2579 , "{f}", .{errors.fmt("input.zon", error.ParseZon)});
2548 , "{f}", .{errors.fmt("input.zon")});
25802549 }
25812550
25822551 {
......@@ -2585,10 +2554,9 @@ test "std.zon string literal" {
25852554 fromSlice([]u8, .{ .gpa = gpa, .arena = arena, .source = "\\\\abcd", .errors = &errors }),
25862555 );
25872556 try std.testing.expectFmt(
2588 \\input.zon: error.ParseZon
25892557 \\input.zon:1:1: error: expected array
25902558 \\
2591 , "{f}", .{errors.fmt("input.zon", error.ParseZon)});
2559 , "{f}", .{errors.fmt("input.zon")});
25922560 }
25932561 }
25942562
......@@ -2609,10 +2577,9 @@ test "std.zon string literal" {
26092577 }),
26102578 );
26112579 try std.testing.expectFmt(
2612 \\input.zon: error.ParseZon
26132580 \\input.zon:1:1: error: expected array
26142581 \\
2615 , "{f}", .{errors.fmt("input.zon", error.ParseZon)});
2582 , "{f}", .{errors.fmt("input.zon")});
26162583 }
26172584
26182585 {
......@@ -2626,10 +2593,9 @@ test "std.zon string literal" {
26262593 }),
26272594 );
26282595 try std.testing.expectFmt(
2629 \\input.zon: error.ParseZon
26302596 \\input.zon:1:1: error: expected array
26312597 \\
2632 , "{f}", .{errors.fmt("input.zon", error.ParseZon)});
2598 , "{f}", .{errors.fmt("input.zon")});
26332599 }
26342600 }
26352601
......@@ -2666,10 +2632,9 @@ test "std.zon string literal" {
26662632 fromSlice([:1]const u8, .{ .gpa = gpa, .arena = arena, .source = "\"foo\"", .errors = &errors }),
26672633 );
26682634 try std.testing.expectFmt(
2669 \\input.zon: error.ParseZon
26702635 \\input.zon:1:1: error: expected array
26712636 \\
2672 , "{f}", .{errors.fmt("input.zon", error.ParseZon)});
2637 , "{f}", .{errors.fmt("input.zon")});
26732638 }
26742639
26752640 {
......@@ -2678,10 +2643,9 @@ test "std.zon string literal" {
26782643 fromSlice([:1]const u8, .{ .gpa = gpa, .arena = arena, .source = "\\\\foo", .errors = &errors }),
26792644 );
26802645 try std.testing.expectFmt(
2681 \\input.zon: error.ParseZon
26822646 \\input.zon:1:1: error: expected array
26832647 \\
2684 , "{f}", .{errors.fmt("input.zon", error.ParseZon)});
2648 , "{f}", .{errors.fmt("input.zon")});
26852649 }
26862650 }
26872651
......@@ -2692,10 +2656,9 @@ test "std.zon string literal" {
26922656 fromSlice([]const u8, .{ .gpa = gpa, .arena = arena, .source = "true", .errors = &errors }),
26932657 );
26942658 try std.testing.expectFmt(
2695 \\input.zon: error.ParseZon
26962659 \\input.zon:1:1: error: expected string
26972660 \\
2698 , "{f}", .{errors.fmt("input.zon", error.ParseZon)});
2661 , "{f}", .{errors.fmt("input.zon")});
26992662 }
27002663
27012664 // Expecting string literal, getting an incompatible tuple
......@@ -2705,10 +2668,9 @@ test "std.zon string literal" {
27052668 fromSlice([]const u8, .{ .gpa = gpa, .arena = arena, .source = ".{false}", .errors = &errors }),
27062669 );
27072670 try std.testing.expectFmt(
2708 \\input.zon: error.ParseZon
27092671 \\input.zon:1:3: error: expected type 'u8'
27102672 \\
2711 , "{f}", .{errors.fmt("input.zon", error.ParseZon)});
2673 , "{f}", .{errors.fmt("input.zon")});
27122674 }
27132675
27142676 // Invalid string literal
......@@ -2718,10 +2680,9 @@ test "std.zon string literal" {
27182680 fromSlice([]const i8, .{ .gpa = gpa, .arena = arena, .source = "\"\\a\"", .errors = &errors }),
27192681 );
27202682 try std.testing.expectFmt(
2721 \\input.zon: error.ParseZon
27222683 \\input.zon:1:3: error: invalid escape character: 'a'
27232684 \\
2724 , "{f}", .{errors.fmt("input.zon", error.ParseZon)});
2685 , "{f}", .{errors.fmt("input.zon")});
27252686 }
27262687
27272688 // Slice wrong child type
......@@ -2732,10 +2693,9 @@ test "std.zon string literal" {
27322693 fromSlice([]const i8, .{ .gpa = gpa, .arena = arena, .source = "\"a\"", .errors = &errors }),
27332694 );
27342695 try std.testing.expectFmt(
2735 \\input.zon: error.ParseZon
27362696 \\input.zon:1:1: error: expected array
27372697 \\
2738 , "{f}", .{errors.fmt("input.zon", error.ParseZon)});
2698 , "{f}", .{errors.fmt("input.zon")});
27392699 }
27402700
27412701 {
......@@ -2744,10 +2704,9 @@ test "std.zon string literal" {
27442704 fromSlice([]const i8, .{ .gpa = gpa, .arena = arena, .source = "\\\\a", .errors = &errors }),
27452705 );
27462706 try std.testing.expectFmt(
2747 \\input.zon: error.ParseZon
27482707 \\input.zon:1:1: error: expected array
27492708 \\
2750 , "{f}", .{errors.fmt("input.zon", error.ParseZon)});
2709 , "{f}", .{errors.fmt("input.zon")});
27512710 }
27522711 }
27532712
......@@ -2764,10 +2723,9 @@ test "std.zon string literal" {
27642723 }),
27652724 );
27662725 try std.testing.expectFmt(
2767 \\input.zon: error.ParseZon
27682726 \\input.zon:1:1: error: expected array
27692727 \\
2770 , "{f}", .{errors.fmt("input.zon", error.ParseZon)});
2728 , "{f}", .{errors.fmt("input.zon")});
27712729 }
27722730
27732731 {
......@@ -2781,10 +2739,9 @@ test "std.zon string literal" {
27812739 }),
27822740 );
27832741 try std.testing.expectFmt(
2784 \\input.zon: error.ParseZon
27852742 \\input.zon:1:1: error: expected array
27862743 \\
2787 , "{f}", .{errors.fmt("input.zon", error.ParseZon)});
2744 , "{f}", .{errors.fmt("input.zon")});
27882745 }
27892746 }
27902747
......@@ -2885,11 +2842,10 @@ test "std.zon enum literals" {
28852842 }),
28862843 );
28872844 try std.testing.expectFmt(
2888 \\input.zon: error.ParseZon
28892845 \\input.zon:1:2: error: unexpected enum literal 'qux'
28902846 \\input.zon:1:2: note: supported: 'foo', 'bar', 'baz', '@"ab\nc"'
28912847 \\
2892 , "{f}", .{errors.fmt("input.zon", error.ParseZon)});
2848 , "{f}", .{errors.fmt("input.zon")});
28932849 }
28942850
28952851 // Bad tag that's too long for parser
......@@ -2904,11 +2860,10 @@ test "std.zon enum literals" {
29042860 }),
29052861 );
29062862 try std.testing.expectFmt(
2907 \\input.zon: error.ParseZon
29082863 \\input.zon:1:2: error: unexpected enum literal 'foobarbaz'
29092864 \\input.zon:1:2: note: supported: 'foo', 'bar', 'baz', '@"ab\nc"'
29102865 \\
2911 , "{f}", .{errors.fmt("input.zon", error.ParseZon)});
2866 , "{f}", .{errors.fmt("input.zon")});
29122867 }
29132868
29142869 // Bad type
......@@ -2923,10 +2878,9 @@ test "std.zon enum literals" {
29232878 }),
29242879 );
29252880 try std.testing.expectFmt(
2926 \\input.zon: error.ParseZon
29272881 \\input.zon:1:1: error: expected enum literal
29282882 \\
2929 , "{f}", .{errors.fmt("input.zon", error.ParseZon)});
2883 , "{f}", .{errors.fmt("input.zon")});
29302884 }
29312885
29322886 // Test embedded nulls in an identifier
......@@ -2941,10 +2895,9 @@ test "std.zon enum literals" {
29412895 }),
29422896 );
29432897 try std.testing.expectFmt(
2944 \\input.zon: error.ParseZon
29452898 \\input.zon:1:2: error: identifier cannot contain null bytes
29462899 \\
2947 , "{f}", .{errors.fmt("input.zon", error.ParseZon)});
2900 , "{f}", .{errors.fmt("input.zon")});
29482901 }
29492902}
29502903
......@@ -2981,12 +2934,11 @@ test "std.zon parse bool" {
29812934 }),
29822935 );
29832936 try std.testing.expectFmt(
2984 \\input.zon: error.ParseZon
29852937 \\input.zon:1:2: error: invalid expression
29862938 \\input.zon:1:2: note: ZON allows identifiers 'true', 'false', 'null', 'inf', and 'nan'
29872939 \\input.zon:1:2: note: precede identifier with '.' for an enum literal
29882940 \\
2989 , "{f}", .{errors.fmt("input.zon", error.ParseZon)});
2941 , "{f}", .{errors.fmt("input.zon")});
29902942 }
29912943 {
29922944 try std.testing.expectError(error.ParseZon, fromSliceNoAlloc(bool, .{
......@@ -2996,10 +2948,9 @@ test "std.zon parse bool" {
29962948 .errors = &errors,
29972949 }));
29982950 try std.testing.expectFmt(
2999 \\input.zon: error.ParseZon
30002951 \\input.zon:1:1: error: expected type 'bool'
30012952 \\
3002 , "{f}", .{errors.fmt("input.zon", error.ParseZon)});
2953 , "{f}", .{errors.fmt("input.zon")});
30032954 }
30042955}
30052956
......@@ -3142,10 +3093,9 @@ test "std.zon parse int" {
31423093 .errors = &errors,
31433094 }));
31443095 try std.testing.expectFmt(
3145 \\input.zon: error.ParseZon
31463096 \\input.zon:1:1: error: type 'i66' cannot represent value
31473097 \\
3148 , "{f}", .{errors.fmt("input.zon", error.ParseZon)});
3098 , "{f}", .{errors.fmt("input.zon")});
31493099 }
31503100 {
31513101 try std.testing.expectError(error.ParseZon, fromSliceNoAlloc(i66, .{
......@@ -3155,10 +3105,9 @@ test "std.zon parse int" {
31553105 .errors = &errors,
31563106 }));
31573107 try std.testing.expectFmt(
3158 \\input.zon: error.ParseZon
31593108 \\input.zon:1:1: error: type 'i66' cannot represent value
31603109 \\
3161 , "{f}", .{errors.fmt("input.zon", error.ParseZon)});
3110 , "{f}", .{errors.fmt("input.zon")});
31623111 }
31633112
31643113 // Test parsing whole number floats as integers
......@@ -3278,10 +3227,9 @@ test "std.zon parse int" {
32783227 .errors = &errors,
32793228 }));
32803229 try std.testing.expectFmt(
3281 \\input.zon: error.ParseZon
32823230 \\input.zon:1:3: error: invalid digit 'a' for decimal base
32833231 \\
3284 , "{f}", .{errors.fmt("input.zon", error.ParseZon)});
3232 , "{f}", .{errors.fmt("input.zon")});
32853233 }
32863234
32873235 // Failing to parse as int
......@@ -3293,10 +3241,9 @@ test "std.zon parse int" {
32933241 .errors = &errors,
32943242 }));
32953243 try std.testing.expectFmt(
3296 \\input.zon: error.ParseZon
32973244 \\input.zon:1:1: error: expected type 'u8'
32983245 \\
3299 , "{f}", .{errors.fmt("input.zon", error.ParseZon)});
3246 , "{f}", .{errors.fmt("input.zon")});
33003247 }
33013248
33023249 // Failing because an int is out of range
......@@ -3308,10 +3255,9 @@ test "std.zon parse int" {
33083255 .errors = &errors,
33093256 }));
33103257 try std.testing.expectFmt(
3311 \\input.zon: error.ParseZon
33123258 \\input.zon:1:1: error: type 'u8' cannot represent value
33133259 \\
3314 , "{f}", .{errors.fmt("input.zon", error.ParseZon)});
3260 , "{f}", .{errors.fmt("input.zon")});
33153261 }
33163262
33173263 // Failing because a negative int is out of range
......@@ -3323,10 +3269,9 @@ test "std.zon parse int" {
33233269 .errors = &errors,
33243270 }));
33253271 try std.testing.expectFmt(
3326 \\input.zon: error.ParseZon
33273272 \\input.zon:1:1: error: type 'i8' cannot represent value
33283273 \\
3329 , "{f}", .{errors.fmt("input.zon", error.ParseZon)});
3274 , "{f}", .{errors.fmt("input.zon")});
33303275 }
33313276
33323277 // Failing because an unsigned int is negative
......@@ -3338,10 +3283,9 @@ test "std.zon parse int" {
33383283 .errors = &errors,
33393284 }));
33403285 try std.testing.expectFmt(
3341 \\input.zon: error.ParseZon
33423286 \\input.zon:1:1: error: type 'u8' cannot represent value
33433287 \\
3344 , "{f}", .{errors.fmt("input.zon", error.ParseZon)});
3288 , "{f}", .{errors.fmt("input.zon")});
33453289 }
33463290
33473291 // Failing because a float is non-whole
......@@ -3353,10 +3297,9 @@ test "std.zon parse int" {
33533297 .errors = &errors,
33543298 }));
33553299 try std.testing.expectFmt(
3356 \\input.zon: error.ParseZon
33573300 \\input.zon:1:1: error: type 'u8' cannot represent value
33583301 \\
3359 , "{f}", .{errors.fmt("input.zon", error.ParseZon)});
3302 , "{f}", .{errors.fmt("input.zon")});
33603303 }
33613304
33623305 // Failing because a float is negative
......@@ -3368,10 +3311,9 @@ test "std.zon parse int" {
33683311 .errors = &errors,
33693312 }));
33703313 try std.testing.expectFmt(
3371 \\input.zon: error.ParseZon
33723314 \\input.zon:1:1: error: type 'u8' cannot represent value
33733315 \\
3374 , "{f}", .{errors.fmt("input.zon", error.ParseZon)});
3316 , "{f}", .{errors.fmt("input.zon")});
33753317 }
33763318
33773319 // Negative integer zero
......@@ -3383,12 +3325,11 @@ test "std.zon parse int" {
33833325 .errors = &errors,
33843326 }));
33853327 try std.testing.expectFmt(
3386 \\input.zon: error.ParseZon
33873328 \\input.zon:1:2: error: integer literal '-0' is ambiguous
33883329 \\input.zon:1:2: note: use '0' for an integer zero
33893330 \\input.zon:1:2: note: use '-0.0' for a floating-point signed zero
33903331 \\
3391 , "{f}", .{errors.fmt("input.zon", error.ParseZon)});
3332 , "{f}", .{errors.fmt("input.zon")});
33923333 }
33933334
33943335 // Negative integer zero casted to float
......@@ -3400,12 +3341,11 @@ test "std.zon parse int" {
34003341 .errors = &errors,
34013342 }));
34023343 try std.testing.expectFmt(
3403 \\input.zon: error.ParseZon
34043344 \\input.zon:1:2: error: integer literal '-0' is ambiguous
34053345 \\input.zon:1:2: note: use '0' for an integer zero
34063346 \\input.zon:1:2: note: use '-0.0' for a floating-point signed zero
34073347 \\
3408 , "{f}", .{errors.fmt("input.zon", error.ParseZon)});
3348 , "{f}", .{errors.fmt("input.zon")});
34093349 }
34103350
34113351 // Negative float 0 is allowed
......@@ -3433,10 +3373,9 @@ test "std.zon parse int" {
34333373 .errors = &errors,
34343374 }));
34353375 try std.testing.expectFmt(
3436 \\input.zon: error.ParseZon
34373376 \\input.zon:1:1: error: expected number or 'inf' after '-'
34383377 \\
3439 , "{f}", .{errors.fmt("input.zon", error.ParseZon)});
3378 , "{f}", .{errors.fmt("input.zon")});
34403379 }
34413380
34423381 {
......@@ -3450,10 +3389,9 @@ test "std.zon parse int" {
34503389 }),
34513390 );
34523391 try std.testing.expectFmt(
3453 \\input.zon: error.ParseZon
34543392 \\input.zon:1:1: error: expected number or 'inf' after '-'
34553393 \\
3456 , "{f}", .{errors.fmt("input.zon", error.ParseZon)});
3394 , "{f}", .{errors.fmt("input.zon")});
34573395 }
34583396
34593397 // Invalid int literal
......@@ -3465,10 +3403,9 @@ test "std.zon parse int" {
34653403 .errors = &errors,
34663404 }));
34673405 try std.testing.expectFmt(
3468 \\input.zon: error.ParseZon
34693406 \\input.zon:1:3: error: invalid digit 'g' for hex base
34703407 \\
3471 , "{f}", .{errors.fmt("input.zon", error.ParseZon)});
3408 , "{f}", .{errors.fmt("input.zon")});
34723409 }
34733410
34743411 // Notes on invalid int literal
......@@ -3480,11 +3417,10 @@ test "std.zon parse int" {
34803417 .errors = &errors,
34813418 }));
34823419 try std.testing.expectFmt(
3483 \\input.zon: error.ParseZon
34843420 \\input.zon:1:1: error: number '0123' has leading zero
34853421 \\input.zon:1:1: note: use '0o' prefix for octal literals
34863422 \\
3487 , "{f}", .{errors.fmt("input.zon", error.ParseZon)});
3423 , "{f}", .{errors.fmt("input.zon")});
34883424 }
34893425}
34903426
......@@ -3503,10 +3439,9 @@ test "std.zon negative char" {
35033439 .errors = &errors,
35043440 }));
35053441 try std.testing.expectFmt(
3506 \\input.zon: error.ParseZon
35073442 \\input.zon:1:1: error: expected number or 'inf' after '-'
35083443 \\
3509 , "{f}", .{errors.fmt("input.zon", error.ParseZon)});
3444 , "{f}", .{errors.fmt("input.zon")});
35103445 }
35113446 {
35123447 try std.testing.expectError(error.ParseZon, fromSliceNoAlloc(i16, .{
......@@ -3516,10 +3451,9 @@ test "std.zon negative char" {
35163451 .errors = &errors,
35173452 }));
35183453 try std.testing.expectFmt(
3519 \\input.zon: error.ParseZon
35203454 \\input.zon:1:1: error: expected number or 'inf' after '-'
35213455 \\
3522 , "{f}", .{errors.fmt("input.zon", error.ParseZon)});
3456 , "{f}", .{errors.fmt("input.zon")});
35233457 }
35243458}
35253459
......@@ -3705,10 +3639,9 @@ test "std.zon parse float" {
37053639 .errors = &errors,
37063640 }));
37073641 try std.testing.expectFmt(
3708 \\input.zon: error.ParseZon
37093642 \\input.zon:1:1: error: expected number or 'inf' after '-'
37103643 \\
3711 , "{f}", .{errors.fmt("input.zon", error.ParseZon)});
3644 , "{f}", .{errors.fmt("input.zon")});
37123645 }
37133646
37143647 // nan as int not allowed
......@@ -3720,10 +3653,9 @@ test "std.zon parse float" {
37203653 .errors = &errors,
37213654 }));
37223655 try std.testing.expectFmt(
3723 \\input.zon: error.ParseZon
37243656 \\input.zon:1:1: error: expected type 'i8'
37253657 \\
3726 , "{f}", .{errors.fmt("input.zon", error.ParseZon)});
3658 , "{f}", .{errors.fmt("input.zon")});
37273659 }
37283660
37293661 // nan as int not allowed
......@@ -3735,10 +3667,9 @@ test "std.zon parse float" {
37353667 .errors = &errors,
37363668 }));
37373669 try std.testing.expectFmt(
3738 \\input.zon: error.ParseZon
37393670 \\input.zon:1:1: error: expected type 'i8'
37403671 \\
3741 , "{f}", .{errors.fmt("input.zon", error.ParseZon)});
3672 , "{f}", .{errors.fmt("input.zon")});
37423673 }
37433674
37443675 // inf as int not allowed
......@@ -3750,10 +3681,9 @@ test "std.zon parse float" {
37503681 .errors = &errors,
37513682 }));
37523683 try std.testing.expectFmt(
3753 \\input.zon: error.ParseZon
37543684 \\input.zon:1:1: error: expected type 'i8'
37553685 \\
3756 , "{f}", .{errors.fmt("input.zon", error.ParseZon)});
3686 , "{f}", .{errors.fmt("input.zon")});
37573687 }
37583688
37593689 // -inf as int not allowed
......@@ -3765,10 +3695,9 @@ test "std.zon parse float" {
37653695 .errors = &errors,
37663696 }));
37673697 try std.testing.expectFmt(
3768 \\input.zon: error.ParseZon
37693698 \\input.zon:1:1: error: expected type 'i8'
37703699 \\
3771 , "{f}", .{errors.fmt("input.zon", error.ParseZon)});
3700 , "{f}", .{errors.fmt("input.zon")});
37723701 }
37733702
37743703 // Bad identifier as float
......@@ -3780,12 +3709,11 @@ test "std.zon parse float" {
37803709 .errors = &errors,
37813710 }));
37823711 try std.testing.expectFmt(
3783 \\input.zon: error.ParseZon
37843712 \\input.zon:1:1: error: invalid expression
37853713 \\input.zon:1:1: note: ZON allows identifiers 'true', 'false', 'null', 'inf', and 'nan'
37863714 \\input.zon:1:1: note: precede identifier with '.' for an enum literal
37873715 \\
3788 , "{f}", .{errors.fmt("input.zon", error.ParseZon)});
3716 , "{f}", .{errors.fmt("input.zon")});
37893717 }
37903718
37913719 {
......@@ -3796,10 +3724,9 @@ test "std.zon parse float" {
37963724 .errors = &errors,
37973725 }));
37983726 try std.testing.expectFmt(
3799 \\input.zon: error.ParseZon
38003727 \\input.zon:1:1: error: expected number or 'inf' after '-'
38013728 \\
3802 , "{f}", .{errors.fmt("input.zon", error.ParseZon)});
3729 , "{f}", .{errors.fmt("input.zon")});
38033730 }
38043731
38053732 // Non float as float
......@@ -3814,10 +3741,9 @@ test "std.zon parse float" {
38143741 }),
38153742 );
38163743 try std.testing.expectFmt(
3817 \\input.zon: error.ParseZon
38183744 \\input.zon:1:1: error: expected type 'f32'
38193745 \\
3820 , "{f}", .{errors.fmt("input.zon", error.ParseZon)});
3746 , "{f}", .{errors.fmt("input.zon")});
38213747 }
38223748}
38233749
......@@ -4057,10 +3983,9 @@ test "std.zon vector" {
40573983 }),
40583984 );
40593985 try std.testing.expectFmt(
4060 \\input.zon: error.ParseZon
40613986 \\input.zon:1:2: error: expected 2 array elements; found 1
40623987 \\
4063 , "{f}", .{errors.fmt("input.zon", error.ParseZon)});
3988 , "{f}", .{errors.fmt("input.zon")});
40643989 }
40653990
40663991 // Too many fields
......@@ -4075,10 +4000,9 @@ test "std.zon vector" {
40754000 }),
40764001 );
40774002 try std.testing.expectFmt(
4078 \\input.zon: error.ParseZon
40794003 \\input.zon:1:13: error: index 2 outside of array of length 2
40804004 \\
4081 , "{f}", .{errors.fmt("input.zon", error.ParseZon)});
4005 , "{f}", .{errors.fmt("input.zon")});
40824006 }
40834007
40844008 // Wrong type fields
......@@ -4093,10 +4017,9 @@ test "std.zon vector" {
40934017 }),
40944018 );
40954019 try std.testing.expectFmt(
4096 \\input.zon: error.ParseZon
40974020 \\input.zon:1:8: error: expected type 'f32'
40984021 \\
4099 , "{f}", .{errors.fmt("input.zon", error.ParseZon)});
4022 , "{f}", .{errors.fmt("input.zon")});
41004023 }
41014024
41024025 // Wrong type
......@@ -4111,10 +4034,9 @@ test "std.zon vector" {
41114034 }),
41124035 );
41134036 try std.testing.expectFmt(
4114 \\input.zon: error.ParseZon
41154037 \\input.zon:1:1: error: expected type '@Vector(3, u8)'
41164038 \\
4117 , "{f}", .{errors.fmt("input.zon", error.ParseZon)});
4039 , "{f}", .{errors.fmt("input.zon")});
41184040 }
41194041
41204042 // Elements should get freed on error
......@@ -4129,10 +4051,9 @@ test "std.zon vector" {
41294051 }),
41304052 );
41314053 try std.testing.expectFmt(
4132 \\input.zon: error.ParseZon
41334054 \\input.zon:1:6: error: expected type 'u8'
41344055 \\
4135 , "{f}", .{errors.fmt("input.zon", error.ParseZon)});
4056 , "{f}", .{errors.fmt("input.zon")});
41364057 }
41374058}
41384059
......@@ -4324,10 +4245,9 @@ test "std.zon add pointers" {
43244245 }),
43254246 );
43264247 try std.testing.expectFmt(
4327 \\input.zon: error.ParseZon
43284248 \\input.zon:1:1: error: expected type '?u8'
43294249 \\
4330 , "{f}", .{errors.fmt("input.zon", error.ParseZon)});
4250 , "{f}", .{errors.fmt("input.zon")});
43314251 }
43324252
43334253 {
......@@ -4341,10 +4261,9 @@ test "std.zon add pointers" {
43414261 }),
43424262 );
43434263 try std.testing.expectFmt(
4344 \\input.zon: error.ParseZon
43454264 \\input.zon:1:1: error: expected type '?f32'
43464265 \\
4347 , "{f}", .{errors.fmt("input.zon", error.ParseZon)});
4266 , "{f}", .{errors.fmt("input.zon")});
43484267 }
43494268
43504269 {
......@@ -4358,10 +4277,9 @@ test "std.zon add pointers" {
43584277 }),
43594278 );
43604279 try std.testing.expectFmt(
4361 \\input.zon: error.ParseZon
43624280 \\input.zon:1:1: error: expected type '?@Vector(3, u8)'
43634281 \\
4364 , "{f}", .{errors.fmt("input.zon", error.ParseZon)});
4282 , "{f}", .{errors.fmt("input.zon")});
43654283 }
43664284
43674285 {
......@@ -4375,10 +4293,9 @@ test "std.zon add pointers" {
43754293 }),
43764294 );
43774295 try std.testing.expectFmt(
4378 \\input.zon: error.ParseZon
43794296 \\input.zon:1:1: error: expected type '?bool'
43804297 \\
4381 , "{f}", .{errors.fmt("input.zon", error.ParseZon)});
4298 , "{f}", .{errors.fmt("input.zon")});
43824299 }
43834300
43844301 {
......@@ -4392,10 +4309,9 @@ test "std.zon add pointers" {
43924309 }),
43934310 );
43944311 try std.testing.expectFmt(
4395 \\input.zon: error.ParseZon
43964312 \\input.zon:1:1: error: expected optional struct
43974313 \\
4398 , "{f}", .{errors.fmt("input.zon", error.ParseZon)});
4314 , "{f}", .{errors.fmt("input.zon")});
43994315 }
44004316
44014317 {
......@@ -4409,10 +4325,9 @@ test "std.zon add pointers" {
44094325 }),
44104326 );
44114327 try std.testing.expectFmt(
4412 \\input.zon: error.ParseZon
44134328 \\input.zon:1:1: error: expected optional tuple
44144329 \\
4415 , "{f}", .{errors.fmt("input.zon", error.ParseZon)});
4330 , "{f}", .{errors.fmt("input.zon")});
44164331 }
44174332
44184333 {
......@@ -4426,10 +4341,9 @@ test "std.zon add pointers" {
44264341 }),
44274342 );
44284343 try std.testing.expectFmt(
4429 \\input.zon: error.ParseZon
44304344 \\input.zon:1:1: error: expected optional union
44314345 \\
4432 , "{f}", .{errors.fmt("input.zon", error.ParseZon)});
4346 , "{f}", .{errors.fmt("input.zon")});
44334347 }
44344348
44354349 {
......@@ -4443,10 +4357,9 @@ test "std.zon add pointers" {
44434357 }),
44444358 );
44454359 try std.testing.expectFmt(
4446 \\input.zon: error.ParseZon
44474360 \\input.zon:1:1: error: expected optional array
44484361 \\
4449 , "{f}", .{errors.fmt("input.zon", error.ParseZon)});
4362 , "{f}", .{errors.fmt("input.zon")});
44504363 }
44514364
44524365 {
......@@ -4460,10 +4373,9 @@ test "std.zon add pointers" {
44604373 }),
44614374 );
44624375 try std.testing.expectFmt(
4463 \\input.zon: error.ParseZon
44644376 \\input.zon:1:1: error: expected optional array
44654377 \\
4466 , "{f}", .{errors.fmt("input.zon", error.ParseZon)});
4378 , "{f}", .{errors.fmt("input.zon")});
44674379 }
44684380
44694381 {
......@@ -4477,10 +4389,9 @@ test "std.zon add pointers" {
44774389 }),
44784390 );
44794391 try std.testing.expectFmt(
4480 \\input.zon: error.ParseZon
44814392 \\input.zon:1:1: error: expected optional array
44824393 \\
4483 , "{f}", .{errors.fmt("input.zon", error.ParseZon)});
4394 , "{f}", .{errors.fmt("input.zon")});
44844395 }
44854396
44864397 {
......@@ -4494,10 +4405,9 @@ test "std.zon add pointers" {
44944405 }),
44954406 );
44964407 try std.testing.expectFmt(
4497 \\input.zon: error.ParseZon
44984408 \\input.zon:1:1: error: expected optional array
44994409 \\
4500 , "{f}", .{errors.fmt("input.zon", error.ParseZon)});
4410 , "{f}", .{errors.fmt("input.zon")});
45014411 }
45024412
45034413 {
......@@ -4511,10 +4421,9 @@ test "std.zon add pointers" {
45114421 }),
45124422 );
45134423 try std.testing.expectFmt(
4514 \\input.zon: error.ParseZon
45154424 \\input.zon:1:1: error: expected optional string
45164425 \\
4517 , "{f}", .{errors.fmt("input.zon", error.ParseZon)});
4426 , "{f}", .{errors.fmt("input.zon")});
45184427 }
45194428
45204429 {
......@@ -4528,10 +4437,9 @@ test "std.zon add pointers" {
45284437 }),
45294438 );
45304439 try std.testing.expectFmt(
4531 \\input.zon: error.ParseZon
45324440 \\input.zon:1:1: error: expected optional enum literal
45334441 \\
4534 , "{f}", .{errors.fmt("input.zon", error.ParseZon)});
4442 , "{f}", .{errors.fmt("input.zon")});
45354443 }
45364444}
45374445
......@@ -4837,10 +4745,9 @@ test "std.zon update optionals" {
48374745 .errors = &errors,
48384746 }));
48394747 try std.testing.expectFmt(
4840 \\input.zon: error.ParseZon
48414748 \\input.zon:1:12: error: missing required field qux
48424749 \\
4843 , "{f}", .{errors.fmt("input.zon", error.ParseZon)});
4750 , "{f}", .{errors.fmt("input.zon")});
48444751 }
48454752
48464753 // Updating an optional that starts out non-null should preserve any values we leave off. It's
......@@ -4966,10 +4873,9 @@ test "std.zon update unions" {
49664873 .errors = &errors,
49674874 }));
49684875 try std.testing.expectFmt(
4969 \\input.zon: error.ParseZon
49704876 \\input.zon:1:12: error: missing required field qux
49714877 \\
4972 , "{f}", .{errors.fmt("input.zon", error.ParseZon)});
4878 , "{f}", .{errors.fmt("input.zon")});
49734879 }
49744880
49754881 // Updating a union should preseve any sub-fields that we left off. It's also okay to leave off