Skip to content

Commit

Permalink
fix ci test
Browse files Browse the repository at this point in the history
  • Loading branch information
jiacai2050 committed Jan 7, 2024
1 parent 8665bea commit cc90ab0
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
7 changes: 6 additions & 1 deletion src/bin/loc.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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),
);
}
}
}
6 changes: 3 additions & 3 deletions src/bin/night-shift.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down Expand Up @@ -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 {
Expand Down
6 changes: 3 additions & 3 deletions src/mod/simargs.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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{});
}
{
Expand All @@ -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",
};
Expand Down Expand Up @@ -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);

Expand Down

0 comments on commit cc90ab0

Please sign in to comment.