Skip to content

Commit 848190f

Browse files
nurpaxnatecraddock
authored andcommitted
Cleanup unnecessary use of @as(), drop testing. prefix from expectEqual
1 parent a147cbc commit 848190f

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/tests.zig

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2168,7 +2168,7 @@ test "compile and run bytecode" {
21682168
try lua.loadBytecode("...", bc);
21692169
try lua.protectedCall(0, 1, 0);
21702170
const v = try lua.toInteger(-1);
2171-
try testing.expectEqual(@as(i32, 133), v);
2171+
try expectEqual(133, v);
21722172

21732173
// Try mutable globals. Calls to mutable globals should produce longer bytecode.
21742174
const src2 = "Foo.print()\nBar.print()";
@@ -2182,7 +2182,7 @@ test "compile and run bytecode" {
21822182
defer testing.allocator.free(bc2);
21832183
// A really crude check for changed bytecode. Better would be to match
21842184
// produced bytecode in text format, but the API doesn't support it.
2185-
try testing.expect(bc1.len < bc2.len);
2185+
try expect(bc1.len < bc2.len);
21862186
}
21872187

21882188
test "userdata dtor" {
@@ -2205,13 +2205,13 @@ test "userdata dtor" {
22052205

22062206
var data = lua.newUserdataDtor(Data, ziglua.wrap(Data.dtor));
22072207
data.gc_hits_ptr = &gc_hits;
2208-
try expectEqual(@as(*const anyopaque, @ptrCast(data)), try lua.toPointer(1));
2209-
try testing.expectEqual(@as(i32, 0), gc_hits);
2208+
try expectEqual(@as(*anyopaque, @ptrCast(data)), try lua.toPointer(1));
2209+
try expectEqual(0, gc_hits);
22102210
lua.pop(1); // don't let the stack hold a ref to the user data
22112211
lua.gcCollect();
2212-
try testing.expectEqual(@as(i32, 1), gc_hits);
2212+
try expectEqual(1, gc_hits);
22132213
lua.gcCollect();
2214-
try testing.expectEqual(@as(i32, 1), gc_hits);
2214+
try expectEqual(1, gc_hits);
22152215
}
22162216
}
22172217

@@ -2233,11 +2233,11 @@ test "tagged userdata" {
22332233
try testing.expectEqual(data.val, data2.val);
22342234

22352235
var tag = try lua.userdataTag(-1);
2236-
try testing.expectEqual(@as(i32, 13), tag);
2236+
try testing.expectEqual(13, tag);
22372237

22382238
lua.setUserdataTag(-1, 100);
22392239
tag = try lua.userdataTag(-1);
2240-
try testing.expectEqual(@as(i32, 100), tag);
2240+
try testing.expectEqual(100, tag);
22412241

22422242
// Test that tag mismatch error handling works. Userdata is not tagged with 123.
22432243
try expectError(error.Fail, lua.toUserdataTagged(Data, -1, 123));

0 commit comments

Comments
 (0)