| ... | @@ -1493,7 +1493,7 @@ test "skipValue" { | ... | @@ -1493,7 +1493,7 @@ test "skipValue" { |
| 1493 | { // An absurd number of nestings | 1493 | { // An absurd number of nestings |
| 1494 | const nestings = 256; | 1494 | const nestings = 256; |
| 1495 | | 1495 | |
| 1496 | testing.expectError( | 1496 | try testing.expectError( |
| 1497 | error.TooManyNestedItems, | 1497 | error.TooManyNestedItems, |
| 1498 | skipValue(&TokenStream.init("[" ** nestings ++ "]" ** nestings)), | 1498 | skipValue(&TokenStream.init("[" ** nestings ++ "]" ** nestings)), |
| 1499 | ); | 1499 | ); |
| ... | @@ -1505,14 +1505,14 @@ test "skipValue" { | ... | @@ -1505,14 +1505,14 @@ test "skipValue" { |
| 1505 | | 1505 | |
| 1506 | try skipValue(&TokenStream.init(deeply_nested_array)); | 1506 | try skipValue(&TokenStream.init(deeply_nested_array)); |
| 1507 | | 1507 | |
| 1508 | testing.expectError( | 1508 | try testing.expectError( |
| 1509 | error.TooManyNestedItems, | 1509 | error.TooManyNestedItems, |
| 1510 | skipValue(&TokenStream.init("[" ++ deeply_nested_array ++ "]")), | 1510 | skipValue(&TokenStream.init("[" ++ deeply_nested_array ++ "]")), |
| 1511 | ); | 1511 | ); |
| 1512 | } | 1512 | } |
| 1513 | | 1513 | |
| 1514 | // Mismatched brace/square bracket | 1514 | // Mismatched brace/square bracket |
| 1515 | testing.expectError( | 1515 | try testing.expectError( |
| 1516 | error.UnexpectedClosingBrace, | 1516 | error.UnexpectedClosingBrace, |
| 1517 | skipValue(&TokenStream.init("[102, 111, 111}")), | 1517 | skipValue(&TokenStream.init("[102, 111, 111}")), |
| 1518 | ); | 1518 | ); |
| ... | @@ -1520,11 +1520,11 @@ test "skipValue" { | ... | @@ -1520,11 +1520,11 @@ test "skipValue" { |
| 1520 | { // should fail if no value found (e.g. immediate close of object) | 1520 | { // should fail if no value found (e.g. immediate close of object) |
| 1521 | var empty_object = TokenStream.init("{}"); | 1521 | var empty_object = TokenStream.init("{}"); |
| 1522 | assert(.ObjectBegin == (try empty_object.next()).?); | 1522 | assert(.ObjectBegin == (try empty_object.next()).?); |
| 1523 | testing.expectError(error.UnexpectedJsonDepth, skipValue(&empty_object)); | 1523 | try testing.expectError(error.UnexpectedJsonDepth, skipValue(&empty_object)); |
| 1524 | | 1524 | |
| 1525 | var empty_array = TokenStream.init("[]"); | 1525 | var empty_array = TokenStream.init("[]"); |
| 1526 | assert(.ArrayBegin == (try empty_array.next()).?); | 1526 | assert(.ArrayBegin == (try empty_array.next()).?); |
| 1527 | testing.expectError(error.UnexpectedJsonDepth, skipValue(&empty_array)); | 1527 | try testing.expectError(error.UnexpectedJsonDepth, skipValue(&empty_array)); |
| 1528 | } | 1528 | } |
| 1529 | } | 1529 | } |
| 1530 | | 1530 | |
| ... | @@ -2152,8 +2152,8 @@ test "parse into struct ignoring unknown fields" { | ... | @@ -2152,8 +2152,8 @@ test "parse into struct ignoring unknown fields" { |
| 2152 | ), ops); | 2152 | ), ops); |
| 2153 | defer parseFree(T, r, ops); | 2153 | defer parseFree(T, r, ops); |
| 2154 | | 2154 | |
| 2155 | testing.expectEqual(@as(i64, 420), r.int); | 2155 | try testing.expectEqual(@as(i64, 420), r.int); |
| 2156 | testing.expectEqualSlices(u8, "zig", r.language); | 2156 | try testing.expectEqualSlices(u8, "zig", r.language); |
| 2157 | } | 2157 | } |
| 2158 | | 2158 | |
| 2159 | /// A non-stream JSON parser which constructs a tree of Value's. | 2159 | /// A non-stream JSON parser which constructs a tree of Value's. |