Skip to content

Commit

Permalink
Handle builtin fields error_set rename
Browse files Browse the repository at this point in the history
Co-authored-by: Techatrix <techatrix@mailbox.org>
  • Loading branch information
mochalins and Techatrix committed Aug 31, 2024
1 parent 55dadf1 commit 253610f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/parser.zig
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,10 @@ fn expectParseEqual(comptime T: type, comptime expected: anytype, s: []const u8)
defer arena_allocator.deinit();
const arena = arena_allocator.allocator();

if (@typeInfo(@TypeOf(expected)) != .error_set) {
const std_builtin_type_rename = comptime std.SemanticVersion.parse("0.14.0-dev.1346+31fef6f11") catch unreachable;
const error_set_tag = comptime if (@import("builtin").zig_version.order(std_builtin_type_rename) == .lt) .ErrorSet else .error_set;

if (@typeInfo(@TypeOf(expected)) != error_set_tag) {
const actual_from_slice = try std.json.parseFromSliceLeaky(T, arena, s, .{});
try std.testing.expectEqualDeep(@as(T, expected), actual_from_slice);

Expand Down

0 comments on commit 253610f

Please sign in to comment.