From 848190f20f0992f1175ab9d16f26af933004b6f0 Mon Sep 17 00:00:00 2001 From: Janne Hellsten Date: Fri, 12 Jan 2024 19:55:16 +0200 Subject: [PATCH] Cleanup unnecessary use of @as(), drop testing. prefix from expectEqual --- src/tests.zig | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/tests.zig b/src/tests.zig index 8a3e776..ad02123 100644 --- a/src/tests.zig +++ b/src/tests.zig @@ -2168,7 +2168,7 @@ test "compile and run bytecode" { try lua.loadBytecode("...", bc); try lua.protectedCall(0, 1, 0); const v = try lua.toInteger(-1); - try testing.expectEqual(@as(i32, 133), v); + try expectEqual(133, v); // Try mutable globals. Calls to mutable globals should produce longer bytecode. const src2 = "Foo.print()\nBar.print()"; @@ -2182,7 +2182,7 @@ test "compile and run bytecode" { defer testing.allocator.free(bc2); // A really crude check for changed bytecode. Better would be to match // produced bytecode in text format, but the API doesn't support it. - try testing.expect(bc1.len < bc2.len); + try expect(bc1.len < bc2.len); } test "userdata dtor" { @@ -2205,13 +2205,13 @@ test "userdata dtor" { var data = lua.newUserdataDtor(Data, ziglua.wrap(Data.dtor)); data.gc_hits_ptr = &gc_hits; - try expectEqual(@as(*const anyopaque, @ptrCast(data)), try lua.toPointer(1)); - try testing.expectEqual(@as(i32, 0), gc_hits); + try expectEqual(@as(*anyopaque, @ptrCast(data)), try lua.toPointer(1)); + try expectEqual(0, gc_hits); lua.pop(1); // don't let the stack hold a ref to the user data lua.gcCollect(); - try testing.expectEqual(@as(i32, 1), gc_hits); + try expectEqual(1, gc_hits); lua.gcCollect(); - try testing.expectEqual(@as(i32, 1), gc_hits); + try expectEqual(1, gc_hits); } } @@ -2233,11 +2233,11 @@ test "tagged userdata" { try testing.expectEqual(data.val, data2.val); var tag = try lua.userdataTag(-1); - try testing.expectEqual(@as(i32, 13), tag); + try testing.expectEqual(13, tag); lua.setUserdataTag(-1, 100); tag = try lua.userdataTag(-1); - try testing.expectEqual(@as(i32, 100), tag); + try testing.expectEqual(100, tag); // Test that tag mismatch error handling works. Userdata is not tagged with 123. try expectError(error.Fail, lua.toUserdataTagged(Data, -1, 123));