Skip to content
This repository was archived by the owner on Nov 11, 2023. It is now read-only.

Update JSON tests to use 'std.testing.expectEqual' #31

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions json.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ test {
const config = try std.json.parseFromSlice(Config, std.testing.allocator, my_json, .{});
defer config.deinit();

try std.testing.expect(config.value.vals.testing == 1);
try std.testing.expect(config.value.vals.production == 42);
try std.testing.expect(config.value.uptime == 9999);
try std.testing.expectEqual(@as(u8, 1), config.value.vals.testing);
try std.testing.expectEqual(@as(u8, 42), config.value.vals.production);
try std.testing.expectEqual(@as(u64, 9_999), config.value.uptime);
}

```
6 changes: 3 additions & 3 deletions src/json.zig
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ test {
const config = try std.json.parseFromSlice(Config, std.testing.allocator, my_json, .{});
defer config.deinit();

try std.testing.expect(config.value.vals.testing == 1);
try std.testing.expect(config.value.vals.production == 42);
try std.testing.expect(config.value.uptime == 9999);
try std.testing.expectEqual(@as(u8, 1), config.value.vals.testing);
try std.testing.expectEqual(@as(u8, 42), config.value.vals.production);
try std.testing.expectEqual(@as(u64, 9_999), config.value.uptime);
}