| ... | @@ -98,12 +98,8 @@ pub const Errors = struct { | ... | @@ -98,12 +98,8 @@ pub const Errors = struct { |
| 98 | pub const empty: Errors = .{ .items = &.{} }; | 98 | pub const empty: Errors = .{ .items = &.{} }; |
| 99 | | 99 | |
| 100 | /// Log the failure with `std.log.err`. | 100 | /// Log the failure with `std.log.err`. |
| 101 | pub fn log( | 101 | pub fn log(self: *const Errors, path: []const u8) void { |
| 102 | self: *const Errors, | 102 | std.log.err("{f}", .{self.fmt(path)}); |
| 103 | path: []const u8, | | |
| 104 | err: error{ OutOfMemory, ParseZon }, | | |
| 105 | ) void { | | |
| 106 | std.log.err("{f}", .{self.fmt(path, err)}); | | |
| 107 | } | 103 | } |
| 108 | | 104 | |
| 109 | test log { | 105 | test log { |
| ... | @@ -123,20 +119,19 @@ pub const Errors = struct { | ... | @@ -123,20 +119,19 @@ pub const Errors = struct { |
| 123 | .arena = arena, | 119 | .arena = arena, |
| 124 | .source = ".{ .foo = 1, .bar = 2 }", | 120 | .source = ".{ .foo = 1, .bar = 2 }", |
| 125 | .errors = &errors, | 121 | .errors = &errors, |
| 126 | }) catch |err| b: { | 122 | }) catch |err| switch (err) { |
| 127 | errors.log("input.zon", err); | 123 | error.OutOfMemory => return error.OutOfMemory, |
| 128 | break :b .{ .foo = 0, .bar = 0 }; | 124 | error.ParseZon => b: { |
| | 125 | errors.log("input.zon"); |
| | 126 | break :b .{ .foo = 0, .bar = 0 }; |
| | 127 | }, |
| 129 | }; | 128 | }; |
| 130 | _ = parsed; | 129 | _ = parsed; |
| 131 | } | 130 | } |
| 132 | | 131 | |
| 133 | /// Log the failure with `std.log.err`, and then terminate the process with exit code 1. | 132 | /// Log the failure with `std.log.err`, and then terminate the process with exit code 1. |
| 134 | pub fn fatal( | 133 | pub fn fatal(self: *const Errors, path: []const u8) noreturn { |
| 135 | self: *const Errors, | 134 | std.process.fatal("{f}", .{self.fmt(path)}); |
| 136 | path: []const u8, | | |
| 137 | err: error{ OutOfMemory, ParseZon }, | | |
| 138 | ) noreturn { | | |
| 139 | std.process.fatal("{f}", .{self.fmt(path, err)}); | | |
| 140 | } | 135 | } |
| 141 | | 136 | |
| 142 | test fatal { | 137 | test fatal { |
| ... | @@ -156,29 +151,25 @@ pub const Errors = struct { | ... | @@ -156,29 +151,25 @@ pub const Errors = struct { |
| 156 | .arena = arena, | 151 | .arena = arena, |
| 157 | .source = ".{ .foo = 1, .bar = 2 }", | 152 | .source = ".{ .foo = 1, .bar = 2 }", |
| 158 | .errors = &errors, | 153 | .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 | }; |
| 160 | _ = parsed; | 158 | _ = parsed; |
| 161 | } | 159 | } |
| 162 | | 160 | |
| 163 | pub fn fmt( | 161 | pub fn fmt(self: *const Errors, path: []const u8) Formatter { |
| 164 | self: *const Errors, | | |
| 165 | path: []const u8, | | |
| 166 | err: error{ OutOfMemory, ParseZon }, | | |
| 167 | ) Formatter { | | |
| 168 | return .{ | 162 | return .{ |
| 169 | .items = self.items, | 163 | .items = self.items, |
| 170 | .path = path, | 164 | .path = path, |
| 171 | .err = err, | | |
| 172 | }; | 165 | }; |
| 173 | } | 166 | } |
| 174 | | 167 | |
| 175 | pub const Formatter = struct { | 168 | pub const Formatter = struct { |
| 176 | path: []const u8, | 169 | path: []const u8, |
| 177 | items: []const Error, | 170 | items: []const Error, |
| 178 | err: error{ OutOfMemory, ParseZon }, | | |
| 179 | | 171 | |
| 180 | pub fn format(self: *const @This(), w: *std.Io.Writer) std.Io.Writer.Error!void { | 172 | 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 }); | | |
| 182 | for (self.items) |e| { | 173 | for (self.items) |e| { |
| 183 | try w.print("{s}:", .{self.path}); | 174 | try w.print("{s}:", .{self.path}); |
| 184 | try w.print("{d}:{d}: error: {s}\n", .{ | 175 | try w.print("{d}:{d}: error: {s}\n", .{ |
| ... | @@ -247,9 +238,12 @@ test fromSlice { | ... | @@ -247,9 +238,12 @@ test fromSlice { |
| 247 | .arena = arena, | 238 | .arena = arena, |
| 248 | .source = source, | 239 | .source = source, |
| 249 | .errors = &errors, | 240 | .errors = &errors, |
| 250 | }) catch |err| { | 241 | }) catch |err| switch (err) { |
| 251 | errors.log("texture_options.zon", err); | 242 | error.OutOfMemory => return err, |
| 252 | return err; | 243 | error.ParseZon => { |
| | 244 | errors.log("texture_options.zon"); |
| | 245 | return err; |
| | 246 | }, |
| 253 | }; | 247 | }; |
| 254 | | 248 | |
| 255 | try std.testing.expectEqualDeep(TextureOptions{ | 249 | try std.testing.expectEqualDeep(TextureOptions{ |
| ... | @@ -319,18 +313,24 @@ test updateFromSlice { | ... | @@ -319,18 +313,24 @@ test updateFromSlice { |
| 319 | .arena = arena, | 313 | .arena = arena, |
| 320 | .source = global_config, | 314 | .source = global_config, |
| 321 | .errors = &errors, | 315 | .errors = &errors, |
| 322 | }) catch |err| { | 316 | }) catch |err| switch (err) { |
| 323 | errors.log("global_config.zon", err); | 317 | error.OutOfMemory => return err, |
| 324 | return err; | 318 | error.ParseZon => { |
| | 319 | errors.log("global_config.zon"); |
| | 320 | return err; |
| | 321 | }, |
| 325 | }; | 322 | }; |
| 326 | updateFromSlice(MyTextEditorConfig, &config, .{ | 323 | updateFromSlice(MyTextEditorConfig, &config, .{ |
| 327 | .gpa = gpa, | 324 | .gpa = gpa, |
| 328 | .arena = arena, | 325 | .arena = arena, |
| 329 | .source = project_config, | 326 | .source = project_config, |
| 330 | .errors = &errors, | 327 | .errors = &errors, |
| 331 | }) catch |err| { | 328 | }) catch |err| switch (err) { |
| 332 | errors.log("project_config.zon", err); | 329 | error.OutOfMemory => return err, |
| 333 | return err; | 330 | error.ParseZon => { |
| | 331 | errors.log("project_config.zon"); |
| | 332 | return err; |
| | 333 | }, |
| 334 | }; | 334 | }; |
| 335 | | 335 | |
| 336 | try std.testing.expectEqualDeep(MyTextEditorConfig{ | 336 | try std.testing.expectEqualDeep(MyTextEditorConfig{ |
| ... | @@ -1395,10 +1395,9 @@ test "std.zon ast errors" { | ... | @@ -1395,10 +1395,9 @@ test "std.zon ast errors" { |
| 1395 | }), | 1395 | }), |
| 1396 | ); | 1396 | ); |
| 1397 | try std.testing.expectFmt( | 1397 | try std.testing.expectFmt( |
| 1398 | \\input.zon: error.ParseZon | | |
| 1399 | \\input.zon:1:13: error: expected ',' after initializer | 1398 | \\input.zon:1:13: error: expected ',' after initializer |
| 1400 | \\ | 1399 | \\ |
| 1401 | , "{f}", .{errors.fmt("input.zon", error.ParseZon)}); | 1400 | , "{f}", .{errors.fmt("input.zon")}); |
| 1402 | } | 1401 | } |
| 1403 | | 1402 | |
| 1404 | test "std.zon comments" { | 1403 | test "std.zon comments" { |
| ... | @@ -1431,10 +1430,9 @@ test "std.zon comments" { | ... | @@ -1431,10 +1430,9 @@ test "std.zon comments" { |
| 1431 | .errors = &errors, | 1430 | .errors = &errors, |
| 1432 | })); | 1431 | })); |
| 1433 | try std.testing.expectFmt( | 1432 | try std.testing.expectFmt( |
| 1434 | \\input.zon: error.ParseZon | | |
| 1435 | \\input.zon:1:1: error: expected expression, found 'a document comment' | 1433 | \\input.zon:1:1: error: expected expression, found 'a document comment' |
| 1436 | \\ | 1434 | \\ |
| 1437 | , "{f}", .{errors.fmt("input.zon", error.ParseZon)}); | 1435 | , "{f}", .{errors.fmt("input.zon")}); |
| 1438 | } | 1436 | } |
| 1439 | } | 1437 | } |
| 1440 | | 1438 | |
| ... | @@ -1452,9 +1450,8 @@ test "std.zon failure/oom formatting" { | ... | @@ -1452,9 +1450,8 @@ test "std.zon failure/oom formatting" { |
| 1452 | .errors = &errors, | 1450 | .errors = &errors, |
| 1453 | })); | 1451 | })); |
| 1454 | try std.testing.expectFmt( | 1452 | try std.testing.expectFmt( |
| 1455 | \\input.zon: error.ParseZon | | |
| 1456 | \\ | 1453 | \\ |
| 1457 | , "{f}", .{errors.fmt("input.zon", error.ParseZon)}); | 1454 | , "{f}", .{errors.fmt("input.zon")}); |
| 1458 | } | 1455 | } |
| 1459 | | 1456 | |
| 1460 | test "std.zon fromSlice syntax error" { | 1457 | test "std.zon fromSlice syntax error" { |
| ... | @@ -1472,6 +1469,10 @@ test "std.zon fromSlice syntax error" { | ... | @@ -1472,6 +1469,10 @@ test "std.zon fromSlice syntax error" { |
| 1472 | .errors = &errors, | 1469 | .errors = &errors, |
| 1473 | }), | 1470 | }), |
| 1474 | ); | 1471 | ); |
| | 1472 | try std.testing.expectFmt( |
| | 1473 | \\input.zon:1:3: error: expected expression, found 'EOF' |
| | 1474 | \\ |
| | 1475 | , "{f}", .{errors.fmt("input.zon")}); |
| 1475 | } | 1476 | } |
| 1476 | | 1477 | |
| 1477 | test "std.zon optional" { | 1478 | test "std.zon optional" { |
| ... | @@ -1609,11 +1610,10 @@ test "std.zon unions" { | ... | @@ -1609,11 +1610,10 @@ test "std.zon unions" { |
| 1609 | }), | 1610 | }), |
| 1610 | ); | 1611 | ); |
| 1611 | try std.testing.expectFmt( | 1612 | try std.testing.expectFmt( |
| 1612 | \\input.zon: error.ParseZon | | |
| 1613 | \\input.zon:1:4: error: unexpected field 'z' | 1613 | \\input.zon:1:4: error: unexpected field 'z' |
| 1614 | \\input.zon:1:4: note: supported: 'x', 'y' | 1614 | \\input.zon:1:4: note: supported: 'x', 'y' |
| 1615 | \\ | 1615 | \\ |
| 1616 | , "{f}", .{errors.fmt("input.zon", error.ParseZon)}); | 1616 | , "{f}", .{errors.fmt("input.zon")}); |
| 1617 | } | 1617 | } |
| 1618 | | 1618 | |
| 1619 | // Explicit void field | 1619 | // Explicit void field |
| ... | @@ -1629,10 +1629,9 @@ test "std.zon unions" { | ... | @@ -1629,10 +1629,9 @@ test "std.zon unions" { |
| 1629 | }), | 1629 | }), |
| 1630 | ); | 1630 | ); |
| 1631 | try std.testing.expectFmt( | 1631 | try std.testing.expectFmt( |
| 1632 | \\input.zon: error.ParseZon | | |
| 1633 | \\input.zon:1:6: error: expected type 'void' | 1632 | \\input.zon:1:6: error: expected type 'void' |
| 1634 | \\ | 1633 | \\ |
| 1635 | , "{f}", .{errors.fmt("input.zon", error.ParseZon)}); | 1634 | , "{f}", .{errors.fmt("input.zon")}); |
| 1636 | } | 1635 | } |
| 1637 | | 1636 | |
| 1638 | // Extra field | 1637 | // Extra field |
| ... | @@ -1648,10 +1647,9 @@ test "std.zon unions" { | ... | @@ -1648,10 +1647,9 @@ test "std.zon unions" { |
| 1648 | }), | 1647 | }), |
| 1649 | ); | 1648 | ); |
| 1650 | try std.testing.expectFmt( | 1649 | try std.testing.expectFmt( |
| 1651 | \\input.zon: error.ParseZon | | |
| 1652 | \\input.zon:1:2: error: expected union | 1650 | \\input.zon:1:2: error: expected union |
| 1653 | \\ | 1651 | \\ |
| 1654 | , "{f}", .{errors.fmt("input.zon", error.ParseZon)}); | 1652 | , "{f}", .{errors.fmt("input.zon")}); |
| 1655 | } | 1653 | } |
| 1656 | | 1654 | |
| 1657 | // No fields | 1655 | // No fields |
| ... | @@ -1667,10 +1665,9 @@ test "std.zon unions" { | ... | @@ -1667,10 +1665,9 @@ test "std.zon unions" { |
| 1667 | }), | 1665 | }), |
| 1668 | ); | 1666 | ); |
| 1669 | try std.testing.expectFmt( | 1667 | try std.testing.expectFmt( |
| 1670 | \\input.zon: error.ParseZon | | |
| 1671 | \\input.zon:1:2: error: expected union | 1668 | \\input.zon:1:2: error: expected union |
| 1672 | \\ | 1669 | \\ |
| 1673 | , "{f}", .{errors.fmt("input.zon", error.ParseZon)}); | 1670 | , "{f}", .{errors.fmt("input.zon")}); |
| 1674 | } | 1671 | } |
| 1675 | | 1672 | |
| 1676 | // Enum literals cannot coerce into untagged unions | 1673 | // Enum literals cannot coerce into untagged unions |
| ... | @@ -1683,10 +1680,9 @@ test "std.zon unions" { | ... | @@ -1683,10 +1680,9 @@ test "std.zon unions" { |
| 1683 | .errors = &errors, | 1680 | .errors = &errors, |
| 1684 | })); | 1681 | })); |
| 1685 | try std.testing.expectFmt( | 1682 | try std.testing.expectFmt( |
| 1686 | \\input.zon: error.ParseZon | | |
| 1687 | \\input.zon:1:2: error: expected union | 1683 | \\input.zon:1:2: error: expected union |
| 1688 | \\ | 1684 | \\ |
| 1689 | , "{f}", .{errors.fmt("input.zon", error.ParseZon)}); | 1685 | , "{f}", .{errors.fmt("input.zon")}); |
| 1690 | } | 1686 | } |
| 1691 | | 1687 | |
| 1692 | // Unknown field for enum literal coercion | 1688 | // Unknown field for enum literal coercion |
| ... | @@ -1699,11 +1695,10 @@ test "std.zon unions" { | ... | @@ -1699,11 +1695,10 @@ test "std.zon unions" { |
| 1699 | .errors = &errors, | 1695 | .errors = &errors, |
| 1700 | })); | 1696 | })); |
| 1701 | try std.testing.expectFmt( | 1697 | try std.testing.expectFmt( |
| 1702 | \\input.zon: error.ParseZon | | |
| 1703 | \\input.zon:1:2: error: unexpected field 'y' | 1698 | \\input.zon:1:2: error: unexpected field 'y' |
| 1704 | \\input.zon:1:2: note: supported: 'x' | 1699 | \\input.zon:1:2: note: supported: 'x' |
| 1705 | \\ | 1700 | \\ |
| 1706 | , "{f}", .{errors.fmt("input.zon", error.ParseZon)}); | 1701 | , "{f}", .{errors.fmt("input.zon")}); |
| 1707 | } | 1702 | } |
| 1708 | | 1703 | |
| 1709 | // Non void field for enum literal coercion | 1704 | // Non void field for enum literal coercion |
| ... | @@ -1716,10 +1711,9 @@ test "std.zon unions" { | ... | @@ -1716,10 +1711,9 @@ test "std.zon unions" { |
| 1716 | .errors = &errors, | 1711 | .errors = &errors, |
| 1717 | })); | 1712 | })); |
| 1718 | try std.testing.expectFmt( | 1713 | try std.testing.expectFmt( |
| 1719 | \\input.zon: error.ParseZon | | |
| 1720 | \\input.zon:1:2: error: expected union | 1714 | \\input.zon:1:2: error: expected union |
| 1721 | \\ | 1715 | \\ |
| 1722 | , "{f}", .{errors.fmt("input.zon", error.ParseZon)}); | 1716 | , "{f}", .{errors.fmt("input.zon")}); |
| 1723 | } | 1717 | } |
| 1724 | } | 1718 | } |
| 1725 | | 1719 | |
| ... | @@ -1796,11 +1790,10 @@ test "std.zon structs" { | ... | @@ -1796,11 +1790,10 @@ test "std.zon structs" { |
| 1796 | }), | 1790 | }), |
| 1797 | ); | 1791 | ); |
| 1798 | try std.testing.expectFmt( | 1792 | try std.testing.expectFmt( |
| 1799 | \\input.zon: error.ParseZon | | |
| 1800 | \\input.zon:1:12: error: unexpected field 'z' | 1793 | \\input.zon:1:12: error: unexpected field 'z' |
| 1801 | \\input.zon:1:12: note: supported: 'x', 'y' | 1794 | \\input.zon:1:12: note: supported: 'x', 'y' |
| 1802 | \\ | 1795 | \\ |
| 1803 | , "{f}", .{errors.fmt("input.zon", error.ParseZon)}); | 1796 | , "{f}", .{errors.fmt("input.zon")}); |
| 1804 | } | 1797 | } |
| 1805 | | 1798 | |
| 1806 | // Duplicate field | 1799 | // Duplicate field |
| ... | @@ -1816,11 +1809,10 @@ test "std.zon structs" { | ... | @@ -1816,11 +1809,10 @@ test "std.zon structs" { |
| 1816 | }), | 1809 | }), |
| 1817 | ); | 1810 | ); |
| 1818 | try std.testing.expectFmt( | 1811 | try std.testing.expectFmt( |
| 1819 | \\input.zon: error.ParseZon | | |
| 1820 | \\input.zon:1:4: error: duplicate struct field name | 1812 | \\input.zon:1:4: error: duplicate struct field name |
| 1821 | \\input.zon:1:12: note: duplicate name here | 1813 | \\input.zon:1:12: note: duplicate name here |
| 1822 | \\ | 1814 | \\ |
| 1823 | , "{f}", .{errors.fmt("input.zon", error.ParseZon)}); | 1815 | , "{f}", .{errors.fmt("input.zon")}); |
| 1824 | } | 1816 | } |
| 1825 | | 1817 | |
| 1826 | // Ignore unknown fields | 1818 | // Ignore unknown fields |
| ... | @@ -1849,11 +1841,10 @@ test "std.zon structs" { | ... | @@ -1849,11 +1841,10 @@ test "std.zon structs" { |
| 1849 | }), | 1841 | }), |
| 1850 | ); | 1842 | ); |
| 1851 | try std.testing.expectFmt( | 1843 | try std.testing.expectFmt( |
| 1852 | \\input.zon: error.ParseZon | | |
| 1853 | \\input.zon:1:4: error: unexpected field 'x' | 1844 | \\input.zon:1:4: error: unexpected field 'x' |
| 1854 | \\input.zon:1:4: note: none expected | 1845 | \\input.zon:1:4: note: none expected |
| 1855 | \\ | 1846 | \\ |
| 1856 | , "{f}", .{errors.fmt("input.zon", error.ParseZon)}); | 1847 | , "{f}", .{errors.fmt("input.zon")}); |
| 1857 | } | 1848 | } |
| 1858 | | 1849 | |
| 1859 | // Missing field | 1850 | // Missing field |
| ... | @@ -1869,10 +1860,9 @@ test "std.zon structs" { | ... | @@ -1869,10 +1860,9 @@ test "std.zon structs" { |
| 1869 | }), | 1860 | }), |
| 1870 | ); | 1861 | ); |
| 1871 | try std.testing.expectFmt( | 1862 | try std.testing.expectFmt( |
| 1872 | \\input.zon: error.ParseZon | | |
| 1873 | \\input.zon:1:2: error: missing required field y | 1863 | \\input.zon:1:2: error: missing required field y |
| 1874 | \\ | 1864 | \\ |
| 1875 | , "{f}", .{errors.fmt("input.zon", error.ParseZon)}); | 1865 | , "{f}", .{errors.fmt("input.zon")}); |
| 1876 | } | 1866 | } |
| 1877 | | 1867 | |
| 1878 | // Default field | 1868 | // Default field |
| ... | @@ -1910,10 +1900,9 @@ test "std.zon structs" { | ... | @@ -1910,10 +1900,9 @@ test "std.zon structs" { |
| 1910 | }); | 1900 | }); |
| 1911 | try std.testing.expectError(error.ParseZon, parsed); | 1901 | try std.testing.expectError(error.ParseZon, parsed); |
| 1912 | try std.testing.expectFmt( | 1902 | try std.testing.expectFmt( |
| 1913 | \\input.zon: error.ParseZon | | |
| 1914 | \\input.zon:1:18: error: cannot initialize comptime field | 1903 | \\input.zon:1:18: error: cannot initialize comptime field |
| 1915 | \\ | 1904 | \\ |
| 1916 | , "{f}", .{errors.fmt("input.zon", error.ParseZon)}); | 1905 | , "{f}", .{errors.fmt("input.zon")}); |
| 1917 | } | 1906 | } |
| 1918 | | 1907 | |
| 1919 | // Enum field (regression test, we were previously getting the field name in an | 1908 | // Enum field (regression test, we were previously getting the field name in an |
| ... | @@ -1953,11 +1942,10 @@ test "std.zon structs" { | ... | @@ -1953,11 +1942,10 @@ test "std.zon structs" { |
| 1953 | }); | 1942 | }); |
| 1954 | try std.testing.expectError(error.ParseZon, parsed); | 1943 | try std.testing.expectError(error.ParseZon, parsed); |
| 1955 | try std.testing.expectFmt( | 1944 | try std.testing.expectFmt( |
| 1956 | \\input.zon: error.ParseZon | | |
| 1957 | \\input.zon:1:1: error: types are not available in ZON | 1945 | \\input.zon:1:1: error: types are not available in ZON |
| 1958 | \\input.zon:1:1: note: replace the type with '.' | 1946 | \\input.zon:1:1: note: replace the type with '.' |
| 1959 | \\ | 1947 | \\ |
| 1960 | , "{f}", .{errors.fmt("input.zon", error.ParseZon)}); | 1948 | , "{f}", .{errors.fmt("input.zon")}); |
| 1961 | } | 1949 | } |
| 1962 | | 1950 | |
| 1963 | // Arrays | 1951 | // Arrays |
| ... | @@ -1970,11 +1958,10 @@ test "std.zon structs" { | ... | @@ -1970,11 +1958,10 @@ test "std.zon structs" { |
| 1970 | }); | 1958 | }); |
| 1971 | try std.testing.expectError(error.ParseZon, parsed); | 1959 | try std.testing.expectError(error.ParseZon, parsed); |
| 1972 | try std.testing.expectFmt( | 1960 | try std.testing.expectFmt( |
| 1973 | \\input.zon: error.ParseZon | | |
| 1974 | \\input.zon:1:1: error: types are not available in ZON | 1961 | \\input.zon:1:1: error: types are not available in ZON |
| 1975 | \\input.zon:1:1: note: replace the type with '.' | 1962 | \\input.zon:1:1: note: replace the type with '.' |
| 1976 | \\ | 1963 | \\ |
| 1977 | , "{f}", .{errors.fmt("input.zon", error.ParseZon)}); | 1964 | , "{f}", .{errors.fmt("input.zon")}); |
| 1978 | } | 1965 | } |
| 1979 | | 1966 | |
| 1980 | // Slices | 1967 | // Slices |
| ... | @@ -1987,11 +1974,10 @@ test "std.zon structs" { | ... | @@ -1987,11 +1974,10 @@ test "std.zon structs" { |
| 1987 | }); | 1974 | }); |
| 1988 | try std.testing.expectError(error.ParseZon, parsed); | 1975 | try std.testing.expectError(error.ParseZon, parsed); |
| 1989 | try std.testing.expectFmt( | 1976 | try std.testing.expectFmt( |
| 1990 | \\input.zon: error.ParseZon | | |
| 1991 | \\input.zon:1:1: error: types are not available in ZON | 1977 | \\input.zon:1:1: error: types are not available in ZON |
| 1992 | \\input.zon:1:1: note: replace the type with '.' | 1978 | \\input.zon:1:1: note: replace the type with '.' |
| 1993 | \\ | 1979 | \\ |
| 1994 | , "{f}", .{errors.fmt("input.zon", error.ParseZon)}); | 1980 | , "{f}", .{errors.fmt("input.zon")}); |
| 1995 | } | 1981 | } |
| 1996 | | 1982 | |
| 1997 | // Tuples | 1983 | // Tuples |
| ... | @@ -2004,11 +1990,10 @@ test "std.zon structs" { | ... | @@ -2004,11 +1990,10 @@ test "std.zon structs" { |
| 2004 | }); | 1990 | }); |
| 2005 | try std.testing.expectError(error.ParseZon, parsed); | 1991 | try std.testing.expectError(error.ParseZon, parsed); |
| 2006 | try std.testing.expectFmt( | 1992 | try std.testing.expectFmt( |
| 2007 | \\input.zon: error.ParseZon | | |
| 2008 | \\input.zon:1:1: error: types are not available in ZON | 1993 | \\input.zon:1:1: error: types are not available in ZON |
| 2009 | \\input.zon:1:1: note: replace the type with '.' | 1994 | \\input.zon:1:1: note: replace the type with '.' |
| 2010 | \\ | 1995 | \\ |
| 2011 | , "{f}", .{errors.fmt("input.zon", error.ParseZon)}); | 1996 | , "{f}", .{errors.fmt("input.zon")}); |
| 2012 | } | 1997 | } |
| 2013 | | 1998 | |
| 2014 | // Nested | 1999 | // Nested |
| ... | @@ -2021,11 +2006,10 @@ test "std.zon structs" { | ... | @@ -2021,11 +2006,10 @@ test "std.zon structs" { |
| 2021 | }); | 2006 | }); |
| 2022 | try std.testing.expectError(error.ParseZon, parsed); | 2007 | try std.testing.expectError(error.ParseZon, parsed); |
| 2023 | try std.testing.expectFmt( | 2008 | try std.testing.expectFmt( |
| 2024 | \\input.zon: error.ParseZon | | |
| 2025 | \\input.zon:1:9: error: types are not available in ZON | 2009 | \\input.zon:1:9: error: types are not available in ZON |
| 2026 | \\input.zon:1:9: note: replace the type with '.' | 2010 | \\input.zon:1:9: note: replace the type with '.' |
| 2027 | \\ | 2011 | \\ |
| 2028 | , "{f}", .{errors.fmt("input.zon", error.ParseZon)}); | 2012 | , "{f}", .{errors.fmt("input.zon")}); |
| 2029 | } | 2013 | } |
| 2030 | } | 2014 | } |
| 2031 | } | 2015 | } |
| ... | @@ -2102,10 +2086,9 @@ test "std.zon tuples" { | ... | @@ -2102,10 +2086,9 @@ test "std.zon tuples" { |
| 2102 | }), | 2086 | }), |
| 2103 | ); | 2087 | ); |
| 2104 | try std.testing.expectFmt( | 2088 | try std.testing.expectFmt( |
| 2105 | \\input.zon: error.ParseZon | | |
| 2106 | \\input.zon:1:14: error: index 2 outside of tuple length 2 | 2089 | \\input.zon:1:14: error: index 2 outside of tuple length 2 |
| 2107 | \\ | 2090 | \\ |
| 2108 | , "{f}", .{errors.fmt("input.zon", error.ParseZon)}); | 2091 | , "{f}", .{errors.fmt("input.zon")}); |
| 2109 | } | 2092 | } |
| 2110 | | 2093 | |
| 2111 | // Extra field | 2094 | // Extra field |
| ... | @@ -2121,10 +2104,9 @@ test "std.zon tuples" { | ... | @@ -2121,10 +2104,9 @@ test "std.zon tuples" { |
| 2121 | }), | 2104 | }), |
| 2122 | ); | 2105 | ); |
| 2123 | try std.testing.expectFmt( | 2106 | try std.testing.expectFmt( |
| 2124 | \\input.zon: error.ParseZon | | |
| 2125 | \\input.zon:1:2: error: missing tuple field with index 1 | 2107 | \\input.zon:1:2: error: missing tuple field with index 1 |
| 2126 | \\ | 2108 | \\ |
| 2127 | , "{f}", .{errors.fmt("input.zon", error.ParseZon)}); | 2109 | , "{f}", .{errors.fmt("input.zon")}); |
| 2128 | } | 2110 | } |
| 2129 | | 2111 | |
| 2130 | // Tuple with unexpected field names | 2112 | // Tuple with unexpected field names |
| ... | @@ -2140,10 +2122,9 @@ test "std.zon tuples" { | ... | @@ -2140,10 +2122,9 @@ test "std.zon tuples" { |
| 2140 | }), | 2122 | }), |
| 2141 | ); | 2123 | ); |
| 2142 | try std.testing.expectFmt( | 2124 | try std.testing.expectFmt( |
| 2143 | \\input.zon: error.ParseZon | | |
| 2144 | \\input.zon:1:2: error: expected tuple | 2125 | \\input.zon:1:2: error: expected tuple |
| 2145 | \\ | 2126 | \\ |
| 2146 | , "{f}", .{errors.fmt("input.zon", error.ParseZon)}); | 2127 | , "{f}", .{errors.fmt("input.zon")}); |
| 2147 | } | 2128 | } |
| 2148 | | 2129 | |
| 2149 | // Struct with missing field names | 2130 | // Struct with missing field names |
| ... | @@ -2159,10 +2140,9 @@ test "std.zon tuples" { | ... | @@ -2159,10 +2140,9 @@ test "std.zon tuples" { |
| 2159 | }), | 2140 | }), |
| 2160 | ); | 2141 | ); |
| 2161 | try std.testing.expectFmt( | 2142 | try std.testing.expectFmt( |
| 2162 | \\input.zon: error.ParseZon | | |
| 2163 | \\input.zon:1:2: error: expected struct | 2143 | \\input.zon:1:2: error: expected struct |
| 2164 | \\ | 2144 | \\ |
| 2165 | , "{f}", .{errors.fmt("input.zon", error.ParseZon)}); | 2145 | , "{f}", .{errors.fmt("input.zon")}); |
| 2166 | } | 2146 | } |
| 2167 | | 2147 | |
| 2168 | // Comptime field | 2148 | // Comptime field |
| ... | @@ -2188,10 +2168,9 @@ test "std.zon tuples" { | ... | @@ -2188,10 +2168,9 @@ test "std.zon tuples" { |
| 2188 | }); | 2168 | }); |
| 2189 | try std.testing.expectError(error.ParseZon, parsed); | 2169 | try std.testing.expectError(error.ParseZon, parsed); |
| 2190 | try std.testing.expectFmt( | 2170 | try std.testing.expectFmt( |
| 2191 | \\input.zon: error.ParseZon | | |
| 2192 | \\input.zon:1:9: error: cannot initialize comptime field | 2171 | \\input.zon:1:9: error: cannot initialize comptime field |
| 2193 | \\ | 2172 | \\ |
| 2194 | , "{f}", .{errors.fmt("input.zon", error.ParseZon)}); | 2173 | , "{f}", .{errors.fmt("input.zon")}); |
| 2195 | } | 2174 | } |
| 2196 | } | 2175 | } |
| 2197 | | 2176 | |
| ... | @@ -2378,10 +2357,9 @@ test "std.zon arrays and slices" { | ... | @@ -2378,10 +2357,9 @@ test "std.zon arrays and slices" { |
| 2378 | }), | 2357 | }), |
| 2379 | ); | 2358 | ); |
| 2380 | try std.testing.expectFmt( | 2359 | try std.testing.expectFmt( |
| 2381 | \\input.zon: error.ParseZon | | |
| 2382 | \\input.zon:1:3: error: index 0 outside of array of length 0 | 2360 | \\input.zon:1:3: error: index 0 outside of array of length 0 |
| 2383 | \\ | 2361 | \\ |
| 2384 | , "{f}", .{errors.fmt("input.zon", error.ParseZon)}); | 2362 | , "{f}", .{errors.fmt("input.zon")}); |
| 2385 | } | 2363 | } |
| 2386 | | 2364 | |
| 2387 | // Expect 1 find 2 | 2365 | // Expect 1 find 2 |
| ... | @@ -2396,10 +2374,9 @@ test "std.zon arrays and slices" { | ... | @@ -2396,10 +2374,9 @@ test "std.zon arrays and slices" { |
| 2396 | }), | 2374 | }), |
| 2397 | ); | 2375 | ); |
| 2398 | try std.testing.expectFmt( | 2376 | try std.testing.expectFmt( |
| 2399 | \\input.zon: error.ParseZon | | |
| 2400 | \\input.zon:1:8: error: index 1 outside of array of length 1 | 2377 | \\input.zon:1:8: error: index 1 outside of array of length 1 |
| 2401 | \\ | 2378 | \\ |
| 2402 | , "{f}", .{errors.fmt("input.zon", error.ParseZon)}); | 2379 | , "{f}", .{errors.fmt("input.zon")}); |
| 2403 | } | 2380 | } |
| 2404 | | 2381 | |
| 2405 | // Expect 2 find 1 | 2382 | // Expect 2 find 1 |
| ... | @@ -2414,10 +2391,9 @@ test "std.zon arrays and slices" { | ... | @@ -2414,10 +2391,9 @@ test "std.zon arrays and slices" { |
| 2414 | }), | 2391 | }), |
| 2415 | ); | 2392 | ); |
| 2416 | try std.testing.expectFmt( | 2393 | try std.testing.expectFmt( |
| 2417 | \\input.zon: error.ParseZon | | |
| 2418 | \\input.zon:1:2: error: expected 2 array elements; found 1 | 2394 | \\input.zon:1:2: error: expected 2 array elements; found 1 |
| 2419 | \\ | 2395 | \\ |
| 2420 | , "{f}", .{errors.fmt("input.zon", error.ParseZon)}); | 2396 | , "{f}", .{errors.fmt("input.zon")}); |
| 2421 | } | 2397 | } |
| 2422 | | 2398 | |
| 2423 | // Expect 3 find 0 | 2399 | // Expect 3 find 0 |
| ... | @@ -2432,10 +2408,9 @@ test "std.zon arrays and slices" { | ... | @@ -2432,10 +2408,9 @@ test "std.zon arrays and slices" { |
| 2432 | }), | 2408 | }), |
| 2433 | ); | 2409 | ); |
| 2434 | try std.testing.expectFmt( | 2410 | try std.testing.expectFmt( |
| 2435 | \\input.zon: error.ParseZon | | |
| 2436 | \\input.zon:1:2: error: expected 3 array elements; found 0 | 2411 | \\input.zon:1:2: error: expected 3 array elements; found 0 |
| 2437 | \\ | 2412 | \\ |
| 2438 | , "{f}", .{errors.fmt("input.zon", error.ParseZon)}); | 2413 | , "{f}", .{errors.fmt("input.zon")}); |
| 2439 | } | 2414 | } |
| 2440 | | 2415 | |
| 2441 | // Wrong inner type | 2416 | // Wrong inner type |
| ... | @@ -2452,10 +2427,9 @@ test "std.zon arrays and slices" { | ... | @@ -2452,10 +2427,9 @@ test "std.zon arrays and slices" { |
| 2452 | }), | 2427 | }), |
| 2453 | ); | 2428 | ); |
| 2454 | try std.testing.expectFmt( | 2429 | try std.testing.expectFmt( |
| 2455 | \\input.zon: error.ParseZon | | |
| 2456 | \\input.zon:1:3: error: expected type 'bool' | 2430 | \\input.zon:1:3: error: expected type 'bool' |
| 2457 | \\ | 2431 | \\ |
| 2458 | , "{f}", .{errors.fmt("input.zon", error.ParseZon)}); | 2432 | , "{f}", .{errors.fmt("input.zon")}); |
| 2459 | } | 2433 | } |
| 2460 | | 2434 | |
| 2461 | // Slice | 2435 | // Slice |
| ... | @@ -2470,10 +2444,9 @@ test "std.zon arrays and slices" { | ... | @@ -2470,10 +2444,9 @@ test "std.zon arrays and slices" { |
| 2470 | }), | 2444 | }), |
| 2471 | ); | 2445 | ); |
| 2472 | try std.testing.expectFmt( | 2446 | try std.testing.expectFmt( |
| 2473 | \\input.zon: error.ParseZon | | |
| 2474 | \\input.zon:1:3: error: expected type 'bool' | 2447 | \\input.zon:1:3: error: expected type 'bool' |
| 2475 | \\ | 2448 | \\ |
| 2476 | , "{f}", .{errors.fmt("input.zon", error.ParseZon)}); | 2449 | , "{f}", .{errors.fmt("input.zon")}); |
| 2477 | } | 2450 | } |
| 2478 | } | 2451 | } |
| 2479 | | 2452 | |
| ... | @@ -2491,10 +2464,9 @@ test "std.zon arrays and slices" { | ... | @@ -2491,10 +2464,9 @@ test "std.zon arrays and slices" { |
| 2491 | }), | 2464 | }), |
| 2492 | ); | 2465 | ); |
| 2493 | try std.testing.expectFmt( | 2466 | try std.testing.expectFmt( |
| 2494 | \\input.zon: error.ParseZon | | |
| 2495 | \\input.zon:1:1: error: expected array | 2467 | \\input.zon:1:1: error: expected array |
| 2496 | \\ | 2468 | \\ |
| 2497 | , "{f}", .{errors.fmt("input.zon", error.ParseZon)}); | 2469 | , "{f}", .{errors.fmt("input.zon")}); |
| 2498 | } | 2470 | } |
| 2499 | | 2471 | |
| 2500 | // Slice | 2472 | // Slice |
| ... | @@ -2504,10 +2476,9 @@ test "std.zon arrays and slices" { | ... | @@ -2504,10 +2476,9 @@ test "std.zon arrays and slices" { |
| 2504 | fromSlice([]u8, .{ .gpa = gpa, .arena = arena, .source = "'a'", .errors = &errors }), | 2476 | fromSlice([]u8, .{ .gpa = gpa, .arena = arena, .source = "'a'", .errors = &errors }), |
| 2505 | ); | 2477 | ); |
| 2506 | try std.testing.expectFmt( | 2478 | try std.testing.expectFmt( |
| 2507 | \\input.zon: error.ParseZon | | |
| 2508 | \\input.zon:1:1: error: expected array | 2479 | \\input.zon:1:1: error: expected array |
| 2509 | \\ | 2480 | \\ |
| 2510 | , "{f}", .{errors.fmt("input.zon", error.ParseZon)}); | 2481 | , "{f}", .{errors.fmt("input.zon")}); |
| 2511 | } | 2482 | } |
| 2512 | } | 2483 | } |
| 2513 | | 2484 | |
| ... | @@ -2518,10 +2489,9 @@ test "std.zon arrays and slices" { | ... | @@ -2518,10 +2489,9 @@ test "std.zon arrays and slices" { |
| 2518 | fromSlice([]u8, .{ .gpa = gpa, .arena = arena, .source = " &.{'a', 'b', 'c'}", .errors = &errors }), | 2489 | fromSlice([]u8, .{ .gpa = gpa, .arena = arena, .source = " &.{'a', 'b', 'c'}", .errors = &errors }), |
| 2519 | ); | 2490 | ); |
| 2520 | try std.testing.expectFmt( | 2491 | try std.testing.expectFmt( |
| 2521 | \\input.zon: error.ParseZon | | |
| 2522 | \\input.zon:1:3: error: pointers are not available in ZON | 2492 | \\input.zon:1:3: error: pointers are not available in ZON |
| 2523 | \\ | 2493 | \\ |
| 2524 | , "{f}", .{errors.fmt("input.zon", error.ParseZon)}); | 2494 | , "{f}", .{errors.fmt("input.zon")}); |
| 2525 | } | 2495 | } |
| 2526 | } | 2496 | } |
| 2527 | | 2497 | |
| ... | @@ -2573,10 +2543,9 @@ test "std.zon string literal" { | ... | @@ -2573,10 +2543,9 @@ test "std.zon string literal" { |
| 2573 | fromSlice([]u8, .{ .gpa = gpa, .arena = arena, .source = "\"abcd\"", .errors = &errors }), | 2543 | fromSlice([]u8, .{ .gpa = gpa, .arena = arena, .source = "\"abcd\"", .errors = &errors }), |
| 2574 | ); | 2544 | ); |
| 2575 | try std.testing.expectFmt( | 2545 | try std.testing.expectFmt( |
| 2576 | \\input.zon: error.ParseZon | | |
| 2577 | \\input.zon:1:1: error: expected array | 2546 | \\input.zon:1:1: error: expected array |
| 2578 | \\ | 2547 | \\ |
| 2579 | , "{f}", .{errors.fmt("input.zon", error.ParseZon)}); | 2548 | , "{f}", .{errors.fmt("input.zon")}); |
| 2580 | } | 2549 | } |
| 2581 | | 2550 | |
| 2582 | { | 2551 | { |
| ... | @@ -2585,10 +2554,9 @@ test "std.zon string literal" { | ... | @@ -2585,10 +2554,9 @@ test "std.zon string literal" { |
| 2585 | fromSlice([]u8, .{ .gpa = gpa, .arena = arena, .source = "\\\\abcd", .errors = &errors }), | 2554 | fromSlice([]u8, .{ .gpa = gpa, .arena = arena, .source = "\\\\abcd", .errors = &errors }), |
| 2586 | ); | 2555 | ); |
| 2587 | try std.testing.expectFmt( | 2556 | try std.testing.expectFmt( |
| 2588 | \\input.zon: error.ParseZon | | |
| 2589 | \\input.zon:1:1: error: expected array | 2557 | \\input.zon:1:1: error: expected array |
| 2590 | \\ | 2558 | \\ |
| 2591 | , "{f}", .{errors.fmt("input.zon", error.ParseZon)}); | 2559 | , "{f}", .{errors.fmt("input.zon")}); |
| 2592 | } | 2560 | } |
| 2593 | } | 2561 | } |
| 2594 | | 2562 | |
| ... | @@ -2609,10 +2577,9 @@ test "std.zon string literal" { | ... | @@ -2609,10 +2577,9 @@ test "std.zon string literal" { |
| 2609 | }), | 2577 | }), |
| 2610 | ); | 2578 | ); |
| 2611 | try std.testing.expectFmt( | 2579 | try std.testing.expectFmt( |
| 2612 | \\input.zon: error.ParseZon | | |
| 2613 | \\input.zon:1:1: error: expected array | 2580 | \\input.zon:1:1: error: expected array |
| 2614 | \\ | 2581 | \\ |
| 2615 | , "{f}", .{errors.fmt("input.zon", error.ParseZon)}); | 2582 | , "{f}", .{errors.fmt("input.zon")}); |
| 2616 | } | 2583 | } |
| 2617 | | 2584 | |
| 2618 | { | 2585 | { |
| ... | @@ -2626,10 +2593,9 @@ test "std.zon string literal" { | ... | @@ -2626,10 +2593,9 @@ test "std.zon string literal" { |
| 2626 | }), | 2593 | }), |
| 2627 | ); | 2594 | ); |
| 2628 | try std.testing.expectFmt( | 2595 | try std.testing.expectFmt( |
| 2629 | \\input.zon: error.ParseZon | | |
| 2630 | \\input.zon:1:1: error: expected array | 2596 | \\input.zon:1:1: error: expected array |
| 2631 | \\ | 2597 | \\ |
| 2632 | , "{f}", .{errors.fmt("input.zon", error.ParseZon)}); | 2598 | , "{f}", .{errors.fmt("input.zon")}); |
| 2633 | } | 2599 | } |
| 2634 | } | 2600 | } |
| 2635 | | 2601 | |
| ... | @@ -2666,10 +2632,9 @@ test "std.zon string literal" { | ... | @@ -2666,10 +2632,9 @@ test "std.zon string literal" { |
| 2666 | fromSlice([:1]const u8, .{ .gpa = gpa, .arena = arena, .source = "\"foo\"", .errors = &errors }), | 2632 | fromSlice([:1]const u8, .{ .gpa = gpa, .arena = arena, .source = "\"foo\"", .errors = &errors }), |
| 2667 | ); | 2633 | ); |
| 2668 | try std.testing.expectFmt( | 2634 | try std.testing.expectFmt( |
| 2669 | \\input.zon: error.ParseZon | | |
| 2670 | \\input.zon:1:1: error: expected array | 2635 | \\input.zon:1:1: error: expected array |
| 2671 | \\ | 2636 | \\ |
| 2672 | , "{f}", .{errors.fmt("input.zon", error.ParseZon)}); | 2637 | , "{f}", .{errors.fmt("input.zon")}); |
| 2673 | } | 2638 | } |
| 2674 | | 2639 | |
| 2675 | { | 2640 | { |
| ... | @@ -2678,10 +2643,9 @@ test "std.zon string literal" { | ... | @@ -2678,10 +2643,9 @@ test "std.zon string literal" { |
| 2678 | fromSlice([:1]const u8, .{ .gpa = gpa, .arena = arena, .source = "\\\\foo", .errors = &errors }), | 2643 | fromSlice([:1]const u8, .{ .gpa = gpa, .arena = arena, .source = "\\\\foo", .errors = &errors }), |
| 2679 | ); | 2644 | ); |
| 2680 | try std.testing.expectFmt( | 2645 | try std.testing.expectFmt( |
| 2681 | \\input.zon: error.ParseZon | | |
| 2682 | \\input.zon:1:1: error: expected array | 2646 | \\input.zon:1:1: error: expected array |
| 2683 | \\ | 2647 | \\ |
| 2684 | , "{f}", .{errors.fmt("input.zon", error.ParseZon)}); | 2648 | , "{f}", .{errors.fmt("input.zon")}); |
| 2685 | } | 2649 | } |
| 2686 | } | 2650 | } |
| 2687 | | 2651 | |
| ... | @@ -2692,10 +2656,9 @@ test "std.zon string literal" { | ... | @@ -2692,10 +2656,9 @@ test "std.zon string literal" { |
| 2692 | fromSlice([]const u8, .{ .gpa = gpa, .arena = arena, .source = "true", .errors = &errors }), | 2656 | fromSlice([]const u8, .{ .gpa = gpa, .arena = arena, .source = "true", .errors = &errors }), |
| 2693 | ); | 2657 | ); |
| 2694 | try std.testing.expectFmt( | 2658 | try std.testing.expectFmt( |
| 2695 | \\input.zon: error.ParseZon | | |
| 2696 | \\input.zon:1:1: error: expected string | 2659 | \\input.zon:1:1: error: expected string |
| 2697 | \\ | 2660 | \\ |
| 2698 | , "{f}", .{errors.fmt("input.zon", error.ParseZon)}); | 2661 | , "{f}", .{errors.fmt("input.zon")}); |
| 2699 | } | 2662 | } |
| 2700 | | 2663 | |
| 2701 | // Expecting string literal, getting an incompatible tuple | 2664 | // Expecting string literal, getting an incompatible tuple |
| ... | @@ -2705,10 +2668,9 @@ test "std.zon string literal" { | ... | @@ -2705,10 +2668,9 @@ test "std.zon string literal" { |
| 2705 | fromSlice([]const u8, .{ .gpa = gpa, .arena = arena, .source = ".{false}", .errors = &errors }), | 2668 | fromSlice([]const u8, .{ .gpa = gpa, .arena = arena, .source = ".{false}", .errors = &errors }), |
| 2706 | ); | 2669 | ); |
| 2707 | try std.testing.expectFmt( | 2670 | try std.testing.expectFmt( |
| 2708 | \\input.zon: error.ParseZon | | |
| 2709 | \\input.zon:1:3: error: expected type 'u8' | 2671 | \\input.zon:1:3: error: expected type 'u8' |
| 2710 | \\ | 2672 | \\ |
| 2711 | , "{f}", .{errors.fmt("input.zon", error.ParseZon)}); | 2673 | , "{f}", .{errors.fmt("input.zon")}); |
| 2712 | } | 2674 | } |
| 2713 | | 2675 | |
| 2714 | // Invalid string literal | 2676 | // Invalid string literal |
| ... | @@ -2718,10 +2680,9 @@ test "std.zon string literal" { | ... | @@ -2718,10 +2680,9 @@ test "std.zon string literal" { |
| 2718 | fromSlice([]const i8, .{ .gpa = gpa, .arena = arena, .source = "\"\\a\"", .errors = &errors }), | 2680 | fromSlice([]const i8, .{ .gpa = gpa, .arena = arena, .source = "\"\\a\"", .errors = &errors }), |
| 2719 | ); | 2681 | ); |
| 2720 | try std.testing.expectFmt( | 2682 | try std.testing.expectFmt( |
| 2721 | \\input.zon: error.ParseZon | | |
| 2722 | \\input.zon:1:3: error: invalid escape character: 'a' | 2683 | \\input.zon:1:3: error: invalid escape character: 'a' |
| 2723 | \\ | 2684 | \\ |
| 2724 | , "{f}", .{errors.fmt("input.zon", error.ParseZon)}); | 2685 | , "{f}", .{errors.fmt("input.zon")}); |
| 2725 | } | 2686 | } |
| 2726 | | 2687 | |
| 2727 | // Slice wrong child type | 2688 | // Slice wrong child type |
| ... | @@ -2732,10 +2693,9 @@ test "std.zon string literal" { | ... | @@ -2732,10 +2693,9 @@ test "std.zon string literal" { |
| 2732 | fromSlice([]const i8, .{ .gpa = gpa, .arena = arena, .source = "\"a\"", .errors = &errors }), | 2693 | fromSlice([]const i8, .{ .gpa = gpa, .arena = arena, .source = "\"a\"", .errors = &errors }), |
| 2733 | ); | 2694 | ); |
| 2734 | try std.testing.expectFmt( | 2695 | try std.testing.expectFmt( |
| 2735 | \\input.zon: error.ParseZon | | |
| 2736 | \\input.zon:1:1: error: expected array | 2696 | \\input.zon:1:1: error: expected array |
| 2737 | \\ | 2697 | \\ |
| 2738 | , "{f}", .{errors.fmt("input.zon", error.ParseZon)}); | 2698 | , "{f}", .{errors.fmt("input.zon")}); |
| 2739 | } | 2699 | } |
| 2740 | | 2700 | |
| 2741 | { | 2701 | { |
| ... | @@ -2744,10 +2704,9 @@ test "std.zon string literal" { | ... | @@ -2744,10 +2704,9 @@ test "std.zon string literal" { |
| 2744 | fromSlice([]const i8, .{ .gpa = gpa, .arena = arena, .source = "\\\\a", .errors = &errors }), | 2704 | fromSlice([]const i8, .{ .gpa = gpa, .arena = arena, .source = "\\\\a", .errors = &errors }), |
| 2745 | ); | 2705 | ); |
| 2746 | try std.testing.expectFmt( | 2706 | try std.testing.expectFmt( |
| 2747 | \\input.zon: error.ParseZon | | |
| 2748 | \\input.zon:1:1: error: expected array | 2707 | \\input.zon:1:1: error: expected array |
| 2749 | \\ | 2708 | \\ |
| 2750 | , "{f}", .{errors.fmt("input.zon", error.ParseZon)}); | 2709 | , "{f}", .{errors.fmt("input.zon")}); |
| 2751 | } | 2710 | } |
| 2752 | } | 2711 | } |
| 2753 | | 2712 | |
| ... | @@ -2764,10 +2723,9 @@ test "std.zon string literal" { | ... | @@ -2764,10 +2723,9 @@ test "std.zon string literal" { |
| 2764 | }), | 2723 | }), |
| 2765 | ); | 2724 | ); |
| 2766 | try std.testing.expectFmt( | 2725 | try std.testing.expectFmt( |
| 2767 | \\input.zon: error.ParseZon | | |
| 2768 | \\input.zon:1:1: error: expected array | 2726 | \\input.zon:1:1: error: expected array |
| 2769 | \\ | 2727 | \\ |
| 2770 | , "{f}", .{errors.fmt("input.zon", error.ParseZon)}); | 2728 | , "{f}", .{errors.fmt("input.zon")}); |
| 2771 | } | 2729 | } |
| 2772 | | 2730 | |
| 2773 | { | 2731 | { |
| ... | @@ -2781,10 +2739,9 @@ test "std.zon string literal" { | ... | @@ -2781,10 +2739,9 @@ test "std.zon string literal" { |
| 2781 | }), | 2739 | }), |
| 2782 | ); | 2740 | ); |
| 2783 | try std.testing.expectFmt( | 2741 | try std.testing.expectFmt( |
| 2784 | \\input.zon: error.ParseZon | | |
| 2785 | \\input.zon:1:1: error: expected array | 2742 | \\input.zon:1:1: error: expected array |
| 2786 | \\ | 2743 | \\ |
| 2787 | , "{f}", .{errors.fmt("input.zon", error.ParseZon)}); | 2744 | , "{f}", .{errors.fmt("input.zon")}); |
| 2788 | } | 2745 | } |
| 2789 | } | 2746 | } |
| 2790 | | 2747 | |
| ... | @@ -2885,11 +2842,10 @@ test "std.zon enum literals" { | ... | @@ -2885,11 +2842,10 @@ test "std.zon enum literals" { |
| 2885 | }), | 2842 | }), |
| 2886 | ); | 2843 | ); |
| 2887 | try std.testing.expectFmt( | 2844 | try std.testing.expectFmt( |
| 2888 | \\input.zon: error.ParseZon | | |
| 2889 | \\input.zon:1:2: error: unexpected enum literal 'qux' | 2845 | \\input.zon:1:2: error: unexpected enum literal 'qux' |
| 2890 | \\input.zon:1:2: note: supported: 'foo', 'bar', 'baz', '@"ab\nc"' | 2846 | \\input.zon:1:2: note: supported: 'foo', 'bar', 'baz', '@"ab\nc"' |
| 2891 | \\ | 2847 | \\ |
| 2892 | , "{f}", .{errors.fmt("input.zon", error.ParseZon)}); | 2848 | , "{f}", .{errors.fmt("input.zon")}); |
| 2893 | } | 2849 | } |
| 2894 | | 2850 | |
| 2895 | // Bad tag that's too long for parser | 2851 | // Bad tag that's too long for parser |
| ... | @@ -2904,11 +2860,10 @@ test "std.zon enum literals" { | ... | @@ -2904,11 +2860,10 @@ test "std.zon enum literals" { |
| 2904 | }), | 2860 | }), |
| 2905 | ); | 2861 | ); |
| 2906 | try std.testing.expectFmt( | 2862 | try std.testing.expectFmt( |
| 2907 | \\input.zon: error.ParseZon | | |
| 2908 | \\input.zon:1:2: error: unexpected enum literal 'foobarbaz' | 2863 | \\input.zon:1:2: error: unexpected enum literal 'foobarbaz' |
| 2909 | \\input.zon:1:2: note: supported: 'foo', 'bar', 'baz', '@"ab\nc"' | 2864 | \\input.zon:1:2: note: supported: 'foo', 'bar', 'baz', '@"ab\nc"' |
| 2910 | \\ | 2865 | \\ |
| 2911 | , "{f}", .{errors.fmt("input.zon", error.ParseZon)}); | 2866 | , "{f}", .{errors.fmt("input.zon")}); |
| 2912 | } | 2867 | } |
| 2913 | | 2868 | |
| 2914 | // Bad type | 2869 | // Bad type |
| ... | @@ -2923,10 +2878,9 @@ test "std.zon enum literals" { | ... | @@ -2923,10 +2878,9 @@ test "std.zon enum literals" { |
| 2923 | }), | 2878 | }), |
| 2924 | ); | 2879 | ); |
| 2925 | try std.testing.expectFmt( | 2880 | try std.testing.expectFmt( |
| 2926 | \\input.zon: error.ParseZon | | |
| 2927 | \\input.zon:1:1: error: expected enum literal | 2881 | \\input.zon:1:1: error: expected enum literal |
| 2928 | \\ | 2882 | \\ |
| 2929 | , "{f}", .{errors.fmt("input.zon", error.ParseZon)}); | 2883 | , "{f}", .{errors.fmt("input.zon")}); |
| 2930 | } | 2884 | } |
| 2931 | | 2885 | |
| 2932 | // Test embedded nulls in an identifier | 2886 | // Test embedded nulls in an identifier |
| ... | @@ -2941,10 +2895,9 @@ test "std.zon enum literals" { | ... | @@ -2941,10 +2895,9 @@ test "std.zon enum literals" { |
| 2941 | }), | 2895 | }), |
| 2942 | ); | 2896 | ); |
| 2943 | try std.testing.expectFmt( | 2897 | try std.testing.expectFmt( |
| 2944 | \\input.zon: error.ParseZon | | |
| 2945 | \\input.zon:1:2: error: identifier cannot contain null bytes | 2898 | \\input.zon:1:2: error: identifier cannot contain null bytes |
| 2946 | \\ | 2899 | \\ |
| 2947 | , "{f}", .{errors.fmt("input.zon", error.ParseZon)}); | 2900 | , "{f}", .{errors.fmt("input.zon")}); |
| 2948 | } | 2901 | } |
| 2949 | } | 2902 | } |
| 2950 | | 2903 | |
| ... | @@ -2981,12 +2934,11 @@ test "std.zon parse bool" { | ... | @@ -2981,12 +2934,11 @@ test "std.zon parse bool" { |
| 2981 | }), | 2934 | }), |
| 2982 | ); | 2935 | ); |
| 2983 | try std.testing.expectFmt( | 2936 | try std.testing.expectFmt( |
| 2984 | \\input.zon: error.ParseZon | | |
| 2985 | \\input.zon:1:2: error: invalid expression | 2937 | \\input.zon:1:2: error: invalid expression |
| 2986 | \\input.zon:1:2: note: ZON allows identifiers 'true', 'false', 'null', 'inf', and 'nan' | 2938 | \\input.zon:1:2: note: ZON allows identifiers 'true', 'false', 'null', 'inf', and 'nan' |
| 2987 | \\input.zon:1:2: note: precede identifier with '.' for an enum literal | 2939 | \\input.zon:1:2: note: precede identifier with '.' for an enum literal |
| 2988 | \\ | 2940 | \\ |
| 2989 | , "{f}", .{errors.fmt("input.zon", error.ParseZon)}); | 2941 | , "{f}", .{errors.fmt("input.zon")}); |
| 2990 | } | 2942 | } |
| 2991 | { | 2943 | { |
| 2992 | try std.testing.expectError(error.ParseZon, fromSliceNoAlloc(bool, .{ | 2944 | try std.testing.expectError(error.ParseZon, fromSliceNoAlloc(bool, .{ |
| ... | @@ -2996,10 +2948,9 @@ test "std.zon parse bool" { | ... | @@ -2996,10 +2948,9 @@ test "std.zon parse bool" { |
| 2996 | .errors = &errors, | 2948 | .errors = &errors, |
| 2997 | })); | 2949 | })); |
| 2998 | try std.testing.expectFmt( | 2950 | try std.testing.expectFmt( |
| 2999 | \\input.zon: error.ParseZon | | |
| 3000 | \\input.zon:1:1: error: expected type 'bool' | 2951 | \\input.zon:1:1: error: expected type 'bool' |
| 3001 | \\ | 2952 | \\ |
| 3002 | , "{f}", .{errors.fmt("input.zon", error.ParseZon)}); | 2953 | , "{f}", .{errors.fmt("input.zon")}); |
| 3003 | } | 2954 | } |
| 3004 | } | 2955 | } |
| 3005 | | 2956 | |
| ... | @@ -3142,10 +3093,9 @@ test "std.zon parse int" { | ... | @@ -3142,10 +3093,9 @@ test "std.zon parse int" { |
| 3142 | .errors = &errors, | 3093 | .errors = &errors, |
| 3143 | })); | 3094 | })); |
| 3144 | try std.testing.expectFmt( | 3095 | try std.testing.expectFmt( |
| 3145 | \\input.zon: error.ParseZon | | |
| 3146 | \\input.zon:1:1: error: type 'i66' cannot represent value | 3096 | \\input.zon:1:1: error: type 'i66' cannot represent value |
| 3147 | \\ | 3097 | \\ |
| 3148 | , "{f}", .{errors.fmt("input.zon", error.ParseZon)}); | 3098 | , "{f}", .{errors.fmt("input.zon")}); |
| 3149 | } | 3099 | } |
| 3150 | { | 3100 | { |
| 3151 | try std.testing.expectError(error.ParseZon, fromSliceNoAlloc(i66, .{ | 3101 | try std.testing.expectError(error.ParseZon, fromSliceNoAlloc(i66, .{ |
| ... | @@ -3155,10 +3105,9 @@ test "std.zon parse int" { | ... | @@ -3155,10 +3105,9 @@ test "std.zon parse int" { |
| 3155 | .errors = &errors, | 3105 | .errors = &errors, |
| 3156 | })); | 3106 | })); |
| 3157 | try std.testing.expectFmt( | 3107 | try std.testing.expectFmt( |
| 3158 | \\input.zon: error.ParseZon | | |
| 3159 | \\input.zon:1:1: error: type 'i66' cannot represent value | 3108 | \\input.zon:1:1: error: type 'i66' cannot represent value |
| 3160 | \\ | 3109 | \\ |
| 3161 | , "{f}", .{errors.fmt("input.zon", error.ParseZon)}); | 3110 | , "{f}", .{errors.fmt("input.zon")}); |
| 3162 | } | 3111 | } |
| 3163 | | 3112 | |
| 3164 | // Test parsing whole number floats as integers | 3113 | // Test parsing whole number floats as integers |
| ... | @@ -3278,10 +3227,9 @@ test "std.zon parse int" { | ... | @@ -3278,10 +3227,9 @@ test "std.zon parse int" { |
| 3278 | .errors = &errors, | 3227 | .errors = &errors, |
| 3279 | })); | 3228 | })); |
| 3280 | try std.testing.expectFmt( | 3229 | try std.testing.expectFmt( |
| 3281 | \\input.zon: error.ParseZon | | |
| 3282 | \\input.zon:1:3: error: invalid digit 'a' for decimal base | 3230 | \\input.zon:1:3: error: invalid digit 'a' for decimal base |
| 3283 | \\ | 3231 | \\ |
| 3284 | , "{f}", .{errors.fmt("input.zon", error.ParseZon)}); | 3232 | , "{f}", .{errors.fmt("input.zon")}); |
| 3285 | } | 3233 | } |
| 3286 | | 3234 | |
| 3287 | // Failing to parse as int | 3235 | // Failing to parse as int |
| ... | @@ -3293,10 +3241,9 @@ test "std.zon parse int" { | ... | @@ -3293,10 +3241,9 @@ test "std.zon parse int" { |
| 3293 | .errors = &errors, | 3241 | .errors = &errors, |
| 3294 | })); | 3242 | })); |
| 3295 | try std.testing.expectFmt( | 3243 | try std.testing.expectFmt( |
| 3296 | \\input.zon: error.ParseZon | | |
| 3297 | \\input.zon:1:1: error: expected type 'u8' | 3244 | \\input.zon:1:1: error: expected type 'u8' |
| 3298 | \\ | 3245 | \\ |
| 3299 | , "{f}", .{errors.fmt("input.zon", error.ParseZon)}); | 3246 | , "{f}", .{errors.fmt("input.zon")}); |
| 3300 | } | 3247 | } |
| 3301 | | 3248 | |
| 3302 | // Failing because an int is out of range | 3249 | // Failing because an int is out of range |
| ... | @@ -3308,10 +3255,9 @@ test "std.zon parse int" { | ... | @@ -3308,10 +3255,9 @@ test "std.zon parse int" { |
| 3308 | .errors = &errors, | 3255 | .errors = &errors, |
| 3309 | })); | 3256 | })); |
| 3310 | try std.testing.expectFmt( | 3257 | try std.testing.expectFmt( |
| 3311 | \\input.zon: error.ParseZon | | |
| 3312 | \\input.zon:1:1: error: type 'u8' cannot represent value | 3258 | \\input.zon:1:1: error: type 'u8' cannot represent value |
| 3313 | \\ | 3259 | \\ |
| 3314 | , "{f}", .{errors.fmt("input.zon", error.ParseZon)}); | 3260 | , "{f}", .{errors.fmt("input.zon")}); |
| 3315 | } | 3261 | } |
| 3316 | | 3262 | |
| 3317 | // Failing because a negative int is out of range | 3263 | // Failing because a negative int is out of range |
| ... | @@ -3323,10 +3269,9 @@ test "std.zon parse int" { | ... | @@ -3323,10 +3269,9 @@ test "std.zon parse int" { |
| 3323 | .errors = &errors, | 3269 | .errors = &errors, |
| 3324 | })); | 3270 | })); |
| 3325 | try std.testing.expectFmt( | 3271 | try std.testing.expectFmt( |
| 3326 | \\input.zon: error.ParseZon | | |
| 3327 | \\input.zon:1:1: error: type 'i8' cannot represent value | 3272 | \\input.zon:1:1: error: type 'i8' cannot represent value |
| 3328 | \\ | 3273 | \\ |
| 3329 | , "{f}", .{errors.fmt("input.zon", error.ParseZon)}); | 3274 | , "{f}", .{errors.fmt("input.zon")}); |
| 3330 | } | 3275 | } |
| 3331 | | 3276 | |
| 3332 | // Failing because an unsigned int is negative | 3277 | // Failing because an unsigned int is negative |
| ... | @@ -3338,10 +3283,9 @@ test "std.zon parse int" { | ... | @@ -3338,10 +3283,9 @@ test "std.zon parse int" { |
| 3338 | .errors = &errors, | 3283 | .errors = &errors, |
| 3339 | })); | 3284 | })); |
| 3340 | try std.testing.expectFmt( | 3285 | try std.testing.expectFmt( |
| 3341 | \\input.zon: error.ParseZon | | |
| 3342 | \\input.zon:1:1: error: type 'u8' cannot represent value | 3286 | \\input.zon:1:1: error: type 'u8' cannot represent value |
| 3343 | \\ | 3287 | \\ |
| 3344 | , "{f}", .{errors.fmt("input.zon", error.ParseZon)}); | 3288 | , "{f}", .{errors.fmt("input.zon")}); |
| 3345 | } | 3289 | } |
| 3346 | | 3290 | |
| 3347 | // Failing because a float is non-whole | 3291 | // Failing because a float is non-whole |
| ... | @@ -3353,10 +3297,9 @@ test "std.zon parse int" { | ... | @@ -3353,10 +3297,9 @@ test "std.zon parse int" { |
| 3353 | .errors = &errors, | 3297 | .errors = &errors, |
| 3354 | })); | 3298 | })); |
| 3355 | try std.testing.expectFmt( | 3299 | try std.testing.expectFmt( |
| 3356 | \\input.zon: error.ParseZon | | |
| 3357 | \\input.zon:1:1: error: type 'u8' cannot represent value | 3300 | \\input.zon:1:1: error: type 'u8' cannot represent value |
| 3358 | \\ | 3301 | \\ |
| 3359 | , "{f}", .{errors.fmt("input.zon", error.ParseZon)}); | 3302 | , "{f}", .{errors.fmt("input.zon")}); |
| 3360 | } | 3303 | } |
| 3361 | | 3304 | |
| 3362 | // Failing because a float is negative | 3305 | // Failing because a float is negative |
| ... | @@ -3368,10 +3311,9 @@ test "std.zon parse int" { | ... | @@ -3368,10 +3311,9 @@ test "std.zon parse int" { |
| 3368 | .errors = &errors, | 3311 | .errors = &errors, |
| 3369 | })); | 3312 | })); |
| 3370 | try std.testing.expectFmt( | 3313 | try std.testing.expectFmt( |
| 3371 | \\input.zon: error.ParseZon | | |
| 3372 | \\input.zon:1:1: error: type 'u8' cannot represent value | 3314 | \\input.zon:1:1: error: type 'u8' cannot represent value |
| 3373 | \\ | 3315 | \\ |
| 3374 | , "{f}", .{errors.fmt("input.zon", error.ParseZon)}); | 3316 | , "{f}", .{errors.fmt("input.zon")}); |
| 3375 | } | 3317 | } |
| 3376 | | 3318 | |
| 3377 | // Negative integer zero | 3319 | // Negative integer zero |
| ... | @@ -3383,12 +3325,11 @@ test "std.zon parse int" { | ... | @@ -3383,12 +3325,11 @@ test "std.zon parse int" { |
| 3383 | .errors = &errors, | 3325 | .errors = &errors, |
| 3384 | })); | 3326 | })); |
| 3385 | try std.testing.expectFmt( | 3327 | try std.testing.expectFmt( |
| 3386 | \\input.zon: error.ParseZon | | |
| 3387 | \\input.zon:1:2: error: integer literal '-0' is ambiguous | 3328 | \\input.zon:1:2: error: integer literal '-0' is ambiguous |
| 3388 | \\input.zon:1:2: note: use '0' for an integer zero | 3329 | \\input.zon:1:2: note: use '0' for an integer zero |
| 3389 | \\input.zon:1:2: note: use '-0.0' for a floating-point signed zero | 3330 | \\input.zon:1:2: note: use '-0.0' for a floating-point signed zero |
| 3390 | \\ | 3331 | \\ |
| 3391 | , "{f}", .{errors.fmt("input.zon", error.ParseZon)}); | 3332 | , "{f}", .{errors.fmt("input.zon")}); |
| 3392 | } | 3333 | } |
| 3393 | | 3334 | |
| 3394 | // Negative integer zero casted to float | 3335 | // Negative integer zero casted to float |
| ... | @@ -3400,12 +3341,11 @@ test "std.zon parse int" { | ... | @@ -3400,12 +3341,11 @@ test "std.zon parse int" { |
| 3400 | .errors = &errors, | 3341 | .errors = &errors, |
| 3401 | })); | 3342 | })); |
| 3402 | try std.testing.expectFmt( | 3343 | try std.testing.expectFmt( |
| 3403 | \\input.zon: error.ParseZon | | |
| 3404 | \\input.zon:1:2: error: integer literal '-0' is ambiguous | 3344 | \\input.zon:1:2: error: integer literal '-0' is ambiguous |
| 3405 | \\input.zon:1:2: note: use '0' for an integer zero | 3345 | \\input.zon:1:2: note: use '0' for an integer zero |
| 3406 | \\input.zon:1:2: note: use '-0.0' for a floating-point signed zero | 3346 | \\input.zon:1:2: note: use '-0.0' for a floating-point signed zero |
| 3407 | \\ | 3347 | \\ |
| 3408 | , "{f}", .{errors.fmt("input.zon", error.ParseZon)}); | 3348 | , "{f}", .{errors.fmt("input.zon")}); |
| 3409 | } | 3349 | } |
| 3410 | | 3350 | |
| 3411 | // Negative float 0 is allowed | 3351 | // Negative float 0 is allowed |
| ... | @@ -3433,10 +3373,9 @@ test "std.zon parse int" { | ... | @@ -3433,10 +3373,9 @@ test "std.zon parse int" { |
| 3433 | .errors = &errors, | 3373 | .errors = &errors, |
| 3434 | })); | 3374 | })); |
| 3435 | try std.testing.expectFmt( | 3375 | try std.testing.expectFmt( |
| 3436 | \\input.zon: error.ParseZon | | |
| 3437 | \\input.zon:1:1: error: expected number or 'inf' after '-' | 3376 | \\input.zon:1:1: error: expected number or 'inf' after '-' |
| 3438 | \\ | 3377 | \\ |
| 3439 | , "{f}", .{errors.fmt("input.zon", error.ParseZon)}); | 3378 | , "{f}", .{errors.fmt("input.zon")}); |
| 3440 | } | 3379 | } |
| 3441 | | 3380 | |
| 3442 | { | 3381 | { |
| ... | @@ -3450,10 +3389,9 @@ test "std.zon parse int" { | ... | @@ -3450,10 +3389,9 @@ test "std.zon parse int" { |
| 3450 | }), | 3389 | }), |
| 3451 | ); | 3390 | ); |
| 3452 | try std.testing.expectFmt( | 3391 | try std.testing.expectFmt( |
| 3453 | \\input.zon: error.ParseZon | | |
| 3454 | \\input.zon:1:1: error: expected number or 'inf' after '-' | 3392 | \\input.zon:1:1: error: expected number or 'inf' after '-' |
| 3455 | \\ | 3393 | \\ |
| 3456 | , "{f}", .{errors.fmt("input.zon", error.ParseZon)}); | 3394 | , "{f}", .{errors.fmt("input.zon")}); |
| 3457 | } | 3395 | } |
| 3458 | | 3396 | |
| 3459 | // Invalid int literal | 3397 | // Invalid int literal |
| ... | @@ -3465,10 +3403,9 @@ test "std.zon parse int" { | ... | @@ -3465,10 +3403,9 @@ test "std.zon parse int" { |
| 3465 | .errors = &errors, | 3403 | .errors = &errors, |
| 3466 | })); | 3404 | })); |
| 3467 | try std.testing.expectFmt( | 3405 | try std.testing.expectFmt( |
| 3468 | \\input.zon: error.ParseZon | | |
| 3469 | \\input.zon:1:3: error: invalid digit 'g' for hex base | 3406 | \\input.zon:1:3: error: invalid digit 'g' for hex base |
| 3470 | \\ | 3407 | \\ |
| 3471 | , "{f}", .{errors.fmt("input.zon", error.ParseZon)}); | 3408 | , "{f}", .{errors.fmt("input.zon")}); |
| 3472 | } | 3409 | } |
| 3473 | | 3410 | |
| 3474 | // Notes on invalid int literal | 3411 | // Notes on invalid int literal |
| ... | @@ -3480,11 +3417,10 @@ test "std.zon parse int" { | ... | @@ -3480,11 +3417,10 @@ test "std.zon parse int" { |
| 3480 | .errors = &errors, | 3417 | .errors = &errors, |
| 3481 | })); | 3418 | })); |
| 3482 | try std.testing.expectFmt( | 3419 | try std.testing.expectFmt( |
| 3483 | \\input.zon: error.ParseZon | | |
| 3484 | \\input.zon:1:1: error: number '0123' has leading zero | 3420 | \\input.zon:1:1: error: number '0123' has leading zero |
| 3485 | \\input.zon:1:1: note: use '0o' prefix for octal literals | 3421 | \\input.zon:1:1: note: use '0o' prefix for octal literals |
| 3486 | \\ | 3422 | \\ |
| 3487 | , "{f}", .{errors.fmt("input.zon", error.ParseZon)}); | 3423 | , "{f}", .{errors.fmt("input.zon")}); |
| 3488 | } | 3424 | } |
| 3489 | } | 3425 | } |
| 3490 | | 3426 | |
| ... | @@ -3503,10 +3439,9 @@ test "std.zon negative char" { | ... | @@ -3503,10 +3439,9 @@ test "std.zon negative char" { |
| 3503 | .errors = &errors, | 3439 | .errors = &errors, |
| 3504 | })); | 3440 | })); |
| 3505 | try std.testing.expectFmt( | 3441 | try std.testing.expectFmt( |
| 3506 | \\input.zon: error.ParseZon | | |
| 3507 | \\input.zon:1:1: error: expected number or 'inf' after '-' | 3442 | \\input.zon:1:1: error: expected number or 'inf' after '-' |
| 3508 | \\ | 3443 | \\ |
| 3509 | , "{f}", .{errors.fmt("input.zon", error.ParseZon)}); | 3444 | , "{f}", .{errors.fmt("input.zon")}); |
| 3510 | } | 3445 | } |
| 3511 | { | 3446 | { |
| 3512 | try std.testing.expectError(error.ParseZon, fromSliceNoAlloc(i16, .{ | 3447 | try std.testing.expectError(error.ParseZon, fromSliceNoAlloc(i16, .{ |
| ... | @@ -3516,10 +3451,9 @@ test "std.zon negative char" { | ... | @@ -3516,10 +3451,9 @@ test "std.zon negative char" { |
| 3516 | .errors = &errors, | 3451 | .errors = &errors, |
| 3517 | })); | 3452 | })); |
| 3518 | try std.testing.expectFmt( | 3453 | try std.testing.expectFmt( |
| 3519 | \\input.zon: error.ParseZon | | |
| 3520 | \\input.zon:1:1: error: expected number or 'inf' after '-' | 3454 | \\input.zon:1:1: error: expected number or 'inf' after '-' |
| 3521 | \\ | 3455 | \\ |
| 3522 | , "{f}", .{errors.fmt("input.zon", error.ParseZon)}); | 3456 | , "{f}", .{errors.fmt("input.zon")}); |
| 3523 | } | 3457 | } |
| 3524 | } | 3458 | } |
| 3525 | | 3459 | |
| ... | @@ -3705,10 +3639,9 @@ test "std.zon parse float" { | ... | @@ -3705,10 +3639,9 @@ test "std.zon parse float" { |
| 3705 | .errors = &errors, | 3639 | .errors = &errors, |
| 3706 | })); | 3640 | })); |
| 3707 | try std.testing.expectFmt( | 3641 | try std.testing.expectFmt( |
| 3708 | \\input.zon: error.ParseZon | | |
| 3709 | \\input.zon:1:1: error: expected number or 'inf' after '-' | 3642 | \\input.zon:1:1: error: expected number or 'inf' after '-' |
| 3710 | \\ | 3643 | \\ |
| 3711 | , "{f}", .{errors.fmt("input.zon", error.ParseZon)}); | 3644 | , "{f}", .{errors.fmt("input.zon")}); |
| 3712 | } | 3645 | } |
| 3713 | | 3646 | |
| 3714 | // nan as int not allowed | 3647 | // nan as int not allowed |
| ... | @@ -3720,10 +3653,9 @@ test "std.zon parse float" { | ... | @@ -3720,10 +3653,9 @@ test "std.zon parse float" { |
| 3720 | .errors = &errors, | 3653 | .errors = &errors, |
| 3721 | })); | 3654 | })); |
| 3722 | try std.testing.expectFmt( | 3655 | try std.testing.expectFmt( |
| 3723 | \\input.zon: error.ParseZon | | |
| 3724 | \\input.zon:1:1: error: expected type 'i8' | 3656 | \\input.zon:1:1: error: expected type 'i8' |
| 3725 | \\ | 3657 | \\ |
| 3726 | , "{f}", .{errors.fmt("input.zon", error.ParseZon)}); | 3658 | , "{f}", .{errors.fmt("input.zon")}); |
| 3727 | } | 3659 | } |
| 3728 | | 3660 | |
| 3729 | // nan as int not allowed | 3661 | // nan as int not allowed |
| ... | @@ -3735,10 +3667,9 @@ test "std.zon parse float" { | ... | @@ -3735,10 +3667,9 @@ test "std.zon parse float" { |
| 3735 | .errors = &errors, | 3667 | .errors = &errors, |
| 3736 | })); | 3668 | })); |
| 3737 | try std.testing.expectFmt( | 3669 | try std.testing.expectFmt( |
| 3738 | \\input.zon: error.ParseZon | | |
| 3739 | \\input.zon:1:1: error: expected type 'i8' | 3670 | \\input.zon:1:1: error: expected type 'i8' |
| 3740 | \\ | 3671 | \\ |
| 3741 | , "{f}", .{errors.fmt("input.zon", error.ParseZon)}); | 3672 | , "{f}", .{errors.fmt("input.zon")}); |
| 3742 | } | 3673 | } |
| 3743 | | 3674 | |
| 3744 | // inf as int not allowed | 3675 | // inf as int not allowed |
| ... | @@ -3750,10 +3681,9 @@ test "std.zon parse float" { | ... | @@ -3750,10 +3681,9 @@ test "std.zon parse float" { |
| 3750 | .errors = &errors, | 3681 | .errors = &errors, |
| 3751 | })); | 3682 | })); |
| 3752 | try std.testing.expectFmt( | 3683 | try std.testing.expectFmt( |
| 3753 | \\input.zon: error.ParseZon | | |
| 3754 | \\input.zon:1:1: error: expected type 'i8' | 3684 | \\input.zon:1:1: error: expected type 'i8' |
| 3755 | \\ | 3685 | \\ |
| 3756 | , "{f}", .{errors.fmt("input.zon", error.ParseZon)}); | 3686 | , "{f}", .{errors.fmt("input.zon")}); |
| 3757 | } | 3687 | } |
| 3758 | | 3688 | |
| 3759 | // -inf as int not allowed | 3689 | // -inf as int not allowed |
| ... | @@ -3765,10 +3695,9 @@ test "std.zon parse float" { | ... | @@ -3765,10 +3695,9 @@ test "std.zon parse float" { |
| 3765 | .errors = &errors, | 3695 | .errors = &errors, |
| 3766 | })); | 3696 | })); |
| 3767 | try std.testing.expectFmt( | 3697 | try std.testing.expectFmt( |
| 3768 | \\input.zon: error.ParseZon | | |
| 3769 | \\input.zon:1:1: error: expected type 'i8' | 3698 | \\input.zon:1:1: error: expected type 'i8' |
| 3770 | \\ | 3699 | \\ |
| 3771 | , "{f}", .{errors.fmt("input.zon", error.ParseZon)}); | 3700 | , "{f}", .{errors.fmt("input.zon")}); |
| 3772 | } | 3701 | } |
| 3773 | | 3702 | |
| 3774 | // Bad identifier as float | 3703 | // Bad identifier as float |
| ... | @@ -3780,12 +3709,11 @@ test "std.zon parse float" { | ... | @@ -3780,12 +3709,11 @@ test "std.zon parse float" { |
| 3780 | .errors = &errors, | 3709 | .errors = &errors, |
| 3781 | })); | 3710 | })); |
| 3782 | try std.testing.expectFmt( | 3711 | try std.testing.expectFmt( |
| 3783 | \\input.zon: error.ParseZon | | |
| 3784 | \\input.zon:1:1: error: invalid expression | 3712 | \\input.zon:1:1: error: invalid expression |
| 3785 | \\input.zon:1:1: note: ZON allows identifiers 'true', 'false', 'null', 'inf', and 'nan' | 3713 | \\input.zon:1:1: note: ZON allows identifiers 'true', 'false', 'null', 'inf', and 'nan' |
| 3786 | \\input.zon:1:1: note: precede identifier with '.' for an enum literal | 3714 | \\input.zon:1:1: note: precede identifier with '.' for an enum literal |
| 3787 | \\ | 3715 | \\ |
| 3788 | , "{f}", .{errors.fmt("input.zon", error.ParseZon)}); | 3716 | , "{f}", .{errors.fmt("input.zon")}); |
| 3789 | } | 3717 | } |
| 3790 | | 3718 | |
| 3791 | { | 3719 | { |
| ... | @@ -3796,10 +3724,9 @@ test "std.zon parse float" { | ... | @@ -3796,10 +3724,9 @@ test "std.zon parse float" { |
| 3796 | .errors = &errors, | 3724 | .errors = &errors, |
| 3797 | })); | 3725 | })); |
| 3798 | try std.testing.expectFmt( | 3726 | try std.testing.expectFmt( |
| 3799 | \\input.zon: error.ParseZon | | |
| 3800 | \\input.zon:1:1: error: expected number or 'inf' after '-' | 3727 | \\input.zon:1:1: error: expected number or 'inf' after '-' |
| 3801 | \\ | 3728 | \\ |
| 3802 | , "{f}", .{errors.fmt("input.zon", error.ParseZon)}); | 3729 | , "{f}", .{errors.fmt("input.zon")}); |
| 3803 | } | 3730 | } |
| 3804 | | 3731 | |
| 3805 | // Non float as float | 3732 | // Non float as float |
| ... | @@ -3814,10 +3741,9 @@ test "std.zon parse float" { | ... | @@ -3814,10 +3741,9 @@ test "std.zon parse float" { |
| 3814 | }), | 3741 | }), |
| 3815 | ); | 3742 | ); |
| 3816 | try std.testing.expectFmt( | 3743 | try std.testing.expectFmt( |
| 3817 | \\input.zon: error.ParseZon | | |
| 3818 | \\input.zon:1:1: error: expected type 'f32' | 3744 | \\input.zon:1:1: error: expected type 'f32' |
| 3819 | \\ | 3745 | \\ |
| 3820 | , "{f}", .{errors.fmt("input.zon", error.ParseZon)}); | 3746 | , "{f}", .{errors.fmt("input.zon")}); |
| 3821 | } | 3747 | } |
| 3822 | } | 3748 | } |
| 3823 | | 3749 | |
| ... | @@ -4057,10 +3983,9 @@ test "std.zon vector" { | ... | @@ -4057,10 +3983,9 @@ test "std.zon vector" { |
| 4057 | }), | 3983 | }), |
| 4058 | ); | 3984 | ); |
| 4059 | try std.testing.expectFmt( | 3985 | try std.testing.expectFmt( |
| 4060 | \\input.zon: error.ParseZon | | |
| 4061 | \\input.zon:1:2: error: expected 2 array elements; found 1 | 3986 | \\input.zon:1:2: error: expected 2 array elements; found 1 |
| 4062 | \\ | 3987 | \\ |
| 4063 | , "{f}", .{errors.fmt("input.zon", error.ParseZon)}); | 3988 | , "{f}", .{errors.fmt("input.zon")}); |
| 4064 | } | 3989 | } |
| 4065 | | 3990 | |
| 4066 | // Too many fields | 3991 | // Too many fields |
| ... | @@ -4075,10 +4000,9 @@ test "std.zon vector" { | ... | @@ -4075,10 +4000,9 @@ test "std.zon vector" { |
| 4075 | }), | 4000 | }), |
| 4076 | ); | 4001 | ); |
| 4077 | try std.testing.expectFmt( | 4002 | try std.testing.expectFmt( |
| 4078 | \\input.zon: error.ParseZon | | |
| 4079 | \\input.zon:1:13: error: index 2 outside of array of length 2 | 4003 | \\input.zon:1:13: error: index 2 outside of array of length 2 |
| 4080 | \\ | 4004 | \\ |
| 4081 | , "{f}", .{errors.fmt("input.zon", error.ParseZon)}); | 4005 | , "{f}", .{errors.fmt("input.zon")}); |
| 4082 | } | 4006 | } |
| 4083 | | 4007 | |
| 4084 | // Wrong type fields | 4008 | // Wrong type fields |
| ... | @@ -4093,10 +4017,9 @@ test "std.zon vector" { | ... | @@ -4093,10 +4017,9 @@ test "std.zon vector" { |
| 4093 | }), | 4017 | }), |
| 4094 | ); | 4018 | ); |
| 4095 | try std.testing.expectFmt( | 4019 | try std.testing.expectFmt( |
| 4096 | \\input.zon: error.ParseZon | | |
| 4097 | \\input.zon:1:8: error: expected type 'f32' | 4020 | \\input.zon:1:8: error: expected type 'f32' |
| 4098 | \\ | 4021 | \\ |
| 4099 | , "{f}", .{errors.fmt("input.zon", error.ParseZon)}); | 4022 | , "{f}", .{errors.fmt("input.zon")}); |
| 4100 | } | 4023 | } |
| 4101 | | 4024 | |
| 4102 | // Wrong type | 4025 | // Wrong type |
| ... | @@ -4111,10 +4034,9 @@ test "std.zon vector" { | ... | @@ -4111,10 +4034,9 @@ test "std.zon vector" { |
| 4111 | }), | 4034 | }), |
| 4112 | ); | 4035 | ); |
| 4113 | try std.testing.expectFmt( | 4036 | try std.testing.expectFmt( |
| 4114 | \\input.zon: error.ParseZon | | |
| 4115 | \\input.zon:1:1: error: expected type '@Vector(3, u8)' | 4037 | \\input.zon:1:1: error: expected type '@Vector(3, u8)' |
| 4116 | \\ | 4038 | \\ |
| 4117 | , "{f}", .{errors.fmt("input.zon", error.ParseZon)}); | 4039 | , "{f}", .{errors.fmt("input.zon")}); |
| 4118 | } | 4040 | } |
| 4119 | | 4041 | |
| 4120 | // Elements should get freed on error | 4042 | // Elements should get freed on error |
| ... | @@ -4129,10 +4051,9 @@ test "std.zon vector" { | ... | @@ -4129,10 +4051,9 @@ test "std.zon vector" { |
| 4129 | }), | 4051 | }), |
| 4130 | ); | 4052 | ); |
| 4131 | try std.testing.expectFmt( | 4053 | try std.testing.expectFmt( |
| 4132 | \\input.zon: error.ParseZon | | |
| 4133 | \\input.zon:1:6: error: expected type 'u8' | 4054 | \\input.zon:1:6: error: expected type 'u8' |
| 4134 | \\ | 4055 | \\ |
| 4135 | , "{f}", .{errors.fmt("input.zon", error.ParseZon)}); | 4056 | , "{f}", .{errors.fmt("input.zon")}); |
| 4136 | } | 4057 | } |
| 4137 | } | 4058 | } |
| 4138 | | 4059 | |
| ... | @@ -4324,10 +4245,9 @@ test "std.zon add pointers" { | ... | @@ -4324,10 +4245,9 @@ test "std.zon add pointers" { |
| 4324 | }), | 4245 | }), |
| 4325 | ); | 4246 | ); |
| 4326 | try std.testing.expectFmt( | 4247 | try std.testing.expectFmt( |
| 4327 | \\input.zon: error.ParseZon | | |
| 4328 | \\input.zon:1:1: error: expected type '?u8' | 4248 | \\input.zon:1:1: error: expected type '?u8' |
| 4329 | \\ | 4249 | \\ |
| 4330 | , "{f}", .{errors.fmt("input.zon", error.ParseZon)}); | 4250 | , "{f}", .{errors.fmt("input.zon")}); |
| 4331 | } | 4251 | } |
| 4332 | | 4252 | |
| 4333 | { | 4253 | { |
| ... | @@ -4341,10 +4261,9 @@ test "std.zon add pointers" { | ... | @@ -4341,10 +4261,9 @@ test "std.zon add pointers" { |
| 4341 | }), | 4261 | }), |
| 4342 | ); | 4262 | ); |
| 4343 | try std.testing.expectFmt( | 4263 | try std.testing.expectFmt( |
| 4344 | \\input.zon: error.ParseZon | | |
| 4345 | \\input.zon:1:1: error: expected type '?f32' | 4264 | \\input.zon:1:1: error: expected type '?f32' |
| 4346 | \\ | 4265 | \\ |
| 4347 | , "{f}", .{errors.fmt("input.zon", error.ParseZon)}); | 4266 | , "{f}", .{errors.fmt("input.zon")}); |
| 4348 | } | 4267 | } |
| 4349 | | 4268 | |
| 4350 | { | 4269 | { |
| ... | @@ -4358,10 +4277,9 @@ test "std.zon add pointers" { | ... | @@ -4358,10 +4277,9 @@ test "std.zon add pointers" { |
| 4358 | }), | 4277 | }), |
| 4359 | ); | 4278 | ); |
| 4360 | try std.testing.expectFmt( | 4279 | try std.testing.expectFmt( |
| 4361 | \\input.zon: error.ParseZon | | |
| 4362 | \\input.zon:1:1: error: expected type '?@Vector(3, u8)' | 4280 | \\input.zon:1:1: error: expected type '?@Vector(3, u8)' |
| 4363 | \\ | 4281 | \\ |
| 4364 | , "{f}", .{errors.fmt("input.zon", error.ParseZon)}); | 4282 | , "{f}", .{errors.fmt("input.zon")}); |
| 4365 | } | 4283 | } |
| 4366 | | 4284 | |
| 4367 | { | 4285 | { |
| ... | @@ -4375,10 +4293,9 @@ test "std.zon add pointers" { | ... | @@ -4375,10 +4293,9 @@ test "std.zon add pointers" { |
| 4375 | }), | 4293 | }), |
| 4376 | ); | 4294 | ); |
| 4377 | try std.testing.expectFmt( | 4295 | try std.testing.expectFmt( |
| 4378 | \\input.zon: error.ParseZon | | |
| 4379 | \\input.zon:1:1: error: expected type '?bool' | 4296 | \\input.zon:1:1: error: expected type '?bool' |
| 4380 | \\ | 4297 | \\ |
| 4381 | , "{f}", .{errors.fmt("input.zon", error.ParseZon)}); | 4298 | , "{f}", .{errors.fmt("input.zon")}); |
| 4382 | } | 4299 | } |
| 4383 | | 4300 | |
| 4384 | { | 4301 | { |
| ... | @@ -4392,10 +4309,9 @@ test "std.zon add pointers" { | ... | @@ -4392,10 +4309,9 @@ test "std.zon add pointers" { |
| 4392 | }), | 4309 | }), |
| 4393 | ); | 4310 | ); |
| 4394 | try std.testing.expectFmt( | 4311 | try std.testing.expectFmt( |
| 4395 | \\input.zon: error.ParseZon | | |
| 4396 | \\input.zon:1:1: error: expected optional struct | 4312 | \\input.zon:1:1: error: expected optional struct |
| 4397 | \\ | 4313 | \\ |
| 4398 | , "{f}", .{errors.fmt("input.zon", error.ParseZon)}); | 4314 | , "{f}", .{errors.fmt("input.zon")}); |
| 4399 | } | 4315 | } |
| 4400 | | 4316 | |
| 4401 | { | 4317 | { |
| ... | @@ -4409,10 +4325,9 @@ test "std.zon add pointers" { | ... | @@ -4409,10 +4325,9 @@ test "std.zon add pointers" { |
| 4409 | }), | 4325 | }), |
| 4410 | ); | 4326 | ); |
| 4411 | try std.testing.expectFmt( | 4327 | try std.testing.expectFmt( |
| 4412 | \\input.zon: error.ParseZon | | |
| 4413 | \\input.zon:1:1: error: expected optional tuple | 4328 | \\input.zon:1:1: error: expected optional tuple |
| 4414 | \\ | 4329 | \\ |
| 4415 | , "{f}", .{errors.fmt("input.zon", error.ParseZon)}); | 4330 | , "{f}", .{errors.fmt("input.zon")}); |
| 4416 | } | 4331 | } |
| 4417 | | 4332 | |
| 4418 | { | 4333 | { |
| ... | @@ -4426,10 +4341,9 @@ test "std.zon add pointers" { | ... | @@ -4426,10 +4341,9 @@ test "std.zon add pointers" { |
| 4426 | }), | 4341 | }), |
| 4427 | ); | 4342 | ); |
| 4428 | try std.testing.expectFmt( | 4343 | try std.testing.expectFmt( |
| 4429 | \\input.zon: error.ParseZon | | |
| 4430 | \\input.zon:1:1: error: expected optional union | 4344 | \\input.zon:1:1: error: expected optional union |
| 4431 | \\ | 4345 | \\ |
| 4432 | , "{f}", .{errors.fmt("input.zon", error.ParseZon)}); | 4346 | , "{f}", .{errors.fmt("input.zon")}); |
| 4433 | } | 4347 | } |
| 4434 | | 4348 | |
| 4435 | { | 4349 | { |
| ... | @@ -4443,10 +4357,9 @@ test "std.zon add pointers" { | ... | @@ -4443,10 +4357,9 @@ test "std.zon add pointers" { |
| 4443 | }), | 4357 | }), |
| 4444 | ); | 4358 | ); |
| 4445 | try std.testing.expectFmt( | 4359 | try std.testing.expectFmt( |
| 4446 | \\input.zon: error.ParseZon | | |
| 4447 | \\input.zon:1:1: error: expected optional array | 4360 | \\input.zon:1:1: error: expected optional array |
| 4448 | \\ | 4361 | \\ |
| 4449 | , "{f}", .{errors.fmt("input.zon", error.ParseZon)}); | 4362 | , "{f}", .{errors.fmt("input.zon")}); |
| 4450 | } | 4363 | } |
| 4451 | | 4364 | |
| 4452 | { | 4365 | { |
| ... | @@ -4460,10 +4373,9 @@ test "std.zon add pointers" { | ... | @@ -4460,10 +4373,9 @@ test "std.zon add pointers" { |
| 4460 | }), | 4373 | }), |
| 4461 | ); | 4374 | ); |
| 4462 | try std.testing.expectFmt( | 4375 | try std.testing.expectFmt( |
| 4463 | \\input.zon: error.ParseZon | | |
| 4464 | \\input.zon:1:1: error: expected optional array | 4376 | \\input.zon:1:1: error: expected optional array |
| 4465 | \\ | 4377 | \\ |
| 4466 | , "{f}", .{errors.fmt("input.zon", error.ParseZon)}); | 4378 | , "{f}", .{errors.fmt("input.zon")}); |
| 4467 | } | 4379 | } |
| 4468 | | 4380 | |
| 4469 | { | 4381 | { |
| ... | @@ -4477,10 +4389,9 @@ test "std.zon add pointers" { | ... | @@ -4477,10 +4389,9 @@ test "std.zon add pointers" { |
| 4477 | }), | 4389 | }), |
| 4478 | ); | 4390 | ); |
| 4479 | try std.testing.expectFmt( | 4391 | try std.testing.expectFmt( |
| 4480 | \\input.zon: error.ParseZon | | |
| 4481 | \\input.zon:1:1: error: expected optional array | 4392 | \\input.zon:1:1: error: expected optional array |
| 4482 | \\ | 4393 | \\ |
| 4483 | , "{f}", .{errors.fmt("input.zon", error.ParseZon)}); | 4394 | , "{f}", .{errors.fmt("input.zon")}); |
| 4484 | } | 4395 | } |
| 4485 | | 4396 | |
| 4486 | { | 4397 | { |
| ... | @@ -4494,10 +4405,9 @@ test "std.zon add pointers" { | ... | @@ -4494,10 +4405,9 @@ test "std.zon add pointers" { |
| 4494 | }), | 4405 | }), |
| 4495 | ); | 4406 | ); |
| 4496 | try std.testing.expectFmt( | 4407 | try std.testing.expectFmt( |
| 4497 | \\input.zon: error.ParseZon | | |
| 4498 | \\input.zon:1:1: error: expected optional array | 4408 | \\input.zon:1:1: error: expected optional array |
| 4499 | \\ | 4409 | \\ |
| 4500 | , "{f}", .{errors.fmt("input.zon", error.ParseZon)}); | 4410 | , "{f}", .{errors.fmt("input.zon")}); |
| 4501 | } | 4411 | } |
| 4502 | | 4412 | |
| 4503 | { | 4413 | { |
| ... | @@ -4511,10 +4421,9 @@ test "std.zon add pointers" { | ... | @@ -4511,10 +4421,9 @@ test "std.zon add pointers" { |
| 4511 | }), | 4421 | }), |
| 4512 | ); | 4422 | ); |
| 4513 | try std.testing.expectFmt( | 4423 | try std.testing.expectFmt( |
| 4514 | \\input.zon: error.ParseZon | | |
| 4515 | \\input.zon:1:1: error: expected optional string | 4424 | \\input.zon:1:1: error: expected optional string |
| 4516 | \\ | 4425 | \\ |
| 4517 | , "{f}", .{errors.fmt("input.zon", error.ParseZon)}); | 4426 | , "{f}", .{errors.fmt("input.zon")}); |
| 4518 | } | 4427 | } |
| 4519 | | 4428 | |
| 4520 | { | 4429 | { |
| ... | @@ -4528,10 +4437,9 @@ test "std.zon add pointers" { | ... | @@ -4528,10 +4437,9 @@ test "std.zon add pointers" { |
| 4528 | }), | 4437 | }), |
| 4529 | ); | 4438 | ); |
| 4530 | try std.testing.expectFmt( | 4439 | try std.testing.expectFmt( |
| 4531 | \\input.zon: error.ParseZon | | |
| 4532 | \\input.zon:1:1: error: expected optional enum literal | 4440 | \\input.zon:1:1: error: expected optional enum literal |
| 4533 | \\ | 4441 | \\ |
| 4534 | , "{f}", .{errors.fmt("input.zon", error.ParseZon)}); | 4442 | , "{f}", .{errors.fmt("input.zon")}); |
| 4535 | } | 4443 | } |
| 4536 | } | 4444 | } |
| 4537 | | 4445 | |
| ... | @@ -4837,10 +4745,9 @@ test "std.zon update optionals" { | ... | @@ -4837,10 +4745,9 @@ test "std.zon update optionals" { |
| 4837 | .errors = &errors, | 4745 | .errors = &errors, |
| 4838 | })); | 4746 | })); |
| 4839 | try std.testing.expectFmt( | 4747 | try std.testing.expectFmt( |
| 4840 | \\input.zon: error.ParseZon | | |
| 4841 | \\input.zon:1:12: error: missing required field qux | 4748 | \\input.zon:1:12: error: missing required field qux |
| 4842 | \\ | 4749 | \\ |
| 4843 | , "{f}", .{errors.fmt("input.zon", error.ParseZon)}); | 4750 | , "{f}", .{errors.fmt("input.zon")}); |
| 4844 | } | 4751 | } |
| 4845 | | 4752 | |
| 4846 | // Updating an optional that starts out non-null should preserve any values we leave off. It's | 4753 | // 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" { | ... | @@ -4966,10 +4873,9 @@ test "std.zon update unions" { |
| 4966 | .errors = &errors, | 4873 | .errors = &errors, |
| 4967 | })); | 4874 | })); |
| 4968 | try std.testing.expectFmt( | 4875 | try std.testing.expectFmt( |
| 4969 | \\input.zon: error.ParseZon | | |
| 4970 | \\input.zon:1:12: error: missing required field qux | 4876 | \\input.zon:1:12: error: missing required field qux |
| 4971 | \\ | 4877 | \\ |
| 4972 | , "{f}", .{errors.fmt("input.zon", error.ParseZon)}); | 4878 | , "{f}", .{errors.fmt("input.zon")}); |
| 4973 | } | 4879 | } |
| 4974 | | 4880 | |
| 4975 | // Updating a union should preseve any sub-fields that we left off. It's also okay to leave off | 4881 | // Updating a union should preseve any sub-fields that we left off. It's also okay to leave off |