File tree Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -2296,6 +2296,24 @@ test "panic fn" {
2296
2296
try expectEqual (@as (? CFn , null ), lua .atPanic (panicFn ));
2297
2297
}
2298
2298
2299
+ test "warn fn" {
2300
+ var lua = try Lua .init (testing .allocator );
2301
+ defer lua .deinit ();
2302
+
2303
+ lua .warning ("this message is going to the void" , false );
2304
+
2305
+ const warnFn = wrap (struct {
2306
+ fn inner (data : ? * anyopaque , msg : []const u8 , to_cont : bool ) void {
2307
+ _ = data ;
2308
+ _ = to_cont ;
2309
+ if (! std .mem .eql (u8 , msg , "this will be caught by the warnFn" )) panic ("test failed" , .{});
2310
+ }
2311
+ }.inner );
2312
+
2313
+ lua .setWarnF (warnFn , null );
2314
+ lua .warning ("this will be caught by the warnFn" , false );
2315
+ }
2316
+
2299
2317
test "concat" {
2300
2318
var lua = try Lua .init (testing .allocator );
2301
2319
defer lua .deinit ();
@@ -2480,12 +2498,10 @@ test "refs" {
2480
2498
_ = Lua .setIUserValue ;
2481
2499
_ = Lua .setMetatable ;
2482
2500
_ = Lua .setTable ;
2483
- _ = Lua .setWarnF ;
2484
2501
_ = Lua .toClose ;
2485
2502
_ = Lua .toPointer ;
2486
2503
_ = Lua .toUserdata ;
2487
2504
_ = Lua .upvalueIndex ;
2488
- _ = Lua .warning ;
2489
2505
_ = Lua .xMove ;
2490
2506
_ = Lua .yield ;
2491
2507
_ = Lua .yieldCont ;
You can’t perform that action at this time.
0 commit comments