diff --git a/src/bin/loc.zig b/src/bin/loc.zig index 58996e7..2406d44 100644 --- a/src/bin/loc.zig +++ b/src/bin/loc.zig @@ -525,6 +525,11 @@ test "LOC Zig/Python/Ruby" { loc.size = expected.size; } } - try std.testing.expectEqual(loc, expected); + inline for (std.meta.fields(@TypeOf(expected))) |field| { + try std.testing.expectEqual( + @field(loc, field.name), + @field(expected, field.name), + ); + } } } diff --git a/src/bin/night-shift.zig b/src/bin/night-shift.zig index ae4f548..dad8252 100644 --- a/src/bin/night-shift.zig +++ b/src/bin/night-shift.zig @@ -103,7 +103,7 @@ const Client = struct { } fn getStatus(self: Self) !*Status { - var status = try self.allocator.create(Status); + const status = try self.allocator.create(Status); const call: *fn (c.id, c.SEL, *Status) callconv(.C) bool = @constCast(@ptrCast(&c.objc_msgSend)); const ret = call(self.inner, c.sel_registerName("getBlueLightStatus:"), status); @@ -126,7 +126,7 @@ const Client = struct { switch (schedule) { .SunSetToSunRise => {}, .Custom => |custom| { - var ptr = try self.allocator.create(CustomSchedule); + const ptr = try self.allocator.create(CustomSchedule); ptr.* = custom; const call: *fn (c.id, c.SEL, [*c]CustomSchedule) callconv(.C) bool = @constCast(@ptrCast(&c.objc_msgSend)); const ret = call(self.inner, c.sel_registerName("setSchedule:"), ptr); @@ -266,7 +266,7 @@ pub fn main() !void { } }, .Toggle => { - var status = try client.getStatus(); + const status = try client.getStatus(); if (status.enabled) { try client.turnOff(); } else { diff --git a/src/mod/simargs.zig b/src/mod/simargs.zig index c763620..5b56c30 100644 --- a/src/mod/simargs.zig +++ b/src/mod/simargs.zig @@ -633,7 +633,7 @@ test "parse/bool value" { const opt = try parser.parse(null, null); defer opt.deinit(); - try std.testing.expectEqual(opt.args, .{ .help = true }); + try std.testing.expect(opt.args.help); try std.testing.expectEqual(opt.positional_args.items, &[_][]const u8{}); } { @@ -649,7 +649,7 @@ test "parse/bool value" { const opt = try parser.parse(null, null); defer opt.deinit(); - try std.testing.expectEqual(opt.args, .{ .help = true }); + try std.testing.expect(opt.args.help); var expected = [_][]const u8{ "true", }; @@ -832,7 +832,7 @@ test "parse/positional arguments" { const opt = try parser.parse("...", null); defer opt.deinit(); - try std.testing.expectEqualDeep(opt.args, .{ .a = 1 }); + try std.testing.expectEqualDeep(opt.args.a, 1); var expected = [_][]const u8{ "-a", "2" }; try std.testing.expectEqualDeep(opt.positional_args.items, &expected);