@@ -76,14 +76,14 @@ test "initialization" {
76
76
lua .deinit ();
77
77
78
78
// attempt to initialize the Zig wrapper with no memory
79
- try expectError (Error .Memory , Lua .init (testing .failing_allocator ));
79
+ try expectError (error .Memory , Lua .init (testing .failing_allocator ));
80
80
81
81
// use the library directly
82
82
lua = try Lua .newState (alloc , null );
83
83
lua .close ();
84
84
85
85
// use the library with a bad AllocFn
86
- try expectError (Error .Memory , Lua .newState (failing_alloc , null ));
86
+ try expectError (error .Memory , Lua .newState (failing_alloc , null ));
87
87
88
88
// use the auxiliary library (uses libc realloc and cannot be checked for leaks!)
89
89
lua = try Lua .newStateAux ();
@@ -332,9 +332,9 @@ test "executing string contents" {
332
332
try expectEqual (LuaType .number , try lua .getGlobalEx ("a" ));
333
333
try expectEqual (@as (i64 , 12 ), try lua .toInteger (1 ));
334
334
335
- try expectError (Error .Syntax , lua .loadString ("bad syntax" ));
335
+ try expectError (error .Syntax , lua .loadString ("bad syntax" ));
336
336
try lua .loadString ("a = g()" );
337
- try expectError (Error .Runtime , lua .protectedCall (0 , 0 , 0 ));
337
+ try expectError (error .Runtime , lua .protectedCall (0 , 0 , 0 ));
338
338
}
339
339
340
340
test "filling and checking the stack" {
@@ -355,7 +355,7 @@ test "filling and checking the stack" {
355
355
try expectEqual (@as (i32 , 30 ), lua .getTop ());
356
356
357
357
// this should fail (beyond max stack size)
358
- try expectError (Error .Fail , lua .checkStack (1_000_000 ));
358
+ try expectError (error .Fail , lua .checkStack (1_000_000 ));
359
359
360
360
// this is small enough it won't fail (would raise an error if it did)
361
361
lua .checkStackAux (40 , null );
@@ -547,7 +547,7 @@ test "function registration" {
547
547
548
548
try lua .doString ("funcs.add(10, 20)" );
549
549
try lua .doString ("funcs.sub('10', 20)" );
550
- try expectError (Error .Runtime , lua .doString ("funcs.placeholder()" ));
550
+ try expectError (error .Runtime , lua .doString ("funcs.placeholder()" ));
551
551
}
552
552
553
553
test "panic fn" {
@@ -657,7 +657,7 @@ test "table access" {
657
657
lua .pushString ("zig" );
658
658
lua .rawSetTable (1 );
659
659
660
- try expectError (Error .Fail , lua .getMetatable (1 ));
660
+ try expectError (error .Fail , lua .getMetatable (1 ));
661
661
662
662
// create a metatable (it isn't a useful one)
663
663
lua .newTable ();
@@ -667,7 +667,7 @@ test "table access" {
667
667
668
668
try lua .getMetatable (1 );
669
669
_ = try lua .getMetaField (1 , "__len" );
670
- try expectError (Error .Fail , lua .getMetaField (1 , "__index" ));
670
+ try expectError (error .Fail , lua .getMetaField (1 , "__index" ));
671
671
672
672
lua .pushBoolean (true );
673
673
lua .setField (1 , "bool" );
@@ -702,7 +702,7 @@ test "conversions" {
702
702
var value : Integer = undefined ;
703
703
try Lua .numberToInteger (3.14 , & value );
704
704
try expectEqual (@as (Integer , 3 ), value );
705
- try expectError (Error .Fail , Lua .numberToInteger (@intToFloat (Number , ziglua .max_integer ) + 10 , & value ));
705
+ try expectError (error .Fail , Lua .numberToInteger (@intToFloat (Number , ziglua .max_integer ) + 10 , & value ));
706
706
707
707
// string conversion
708
708
try lua .stringToNumber ("1" );
@@ -713,9 +713,9 @@ test "conversions" {
713
713
try expect (lua .isNumber (-1 ));
714
714
try expectEqual (@as (Number , 1.0 ), try lua .toNumber (-1 ));
715
715
716
- try expectError (Error .Fail , lua .stringToNumber ("a" ));
717
- try expectError (Error .Fail , lua .stringToNumber ("1.a" ));
718
- try expectError (Error .Fail , lua .stringToNumber ("" ));
716
+ try expectError (error .Fail , lua .stringToNumber ("a" ));
717
+ try expectError (error .Fail , lua .stringToNumber ("1.a" ));
718
+ try expectError (error .Fail , lua .stringToNumber ("" ));
719
719
720
720
// index conversion
721
721
try expectEqual (@as (i32 , 2 ), lua .absIndex (-1 ));
@@ -812,8 +812,8 @@ test "userdata and uservalues" {
812
812
try expectEqual (LuaType .string , try lua .getIndexUserValue (1 , 2 ));
813
813
try expectEqualStrings ("test string" , try lua .toBytes (-1 ));
814
814
815
- try expectError (Error .Fail , lua .setIndexUserValue (1 , 3 ));
816
- try expectError (Error .Fail , lua .getIndexUserValue (1 , 3 ));
815
+ try expectError (error .Fail , lua .setIndexUserValue (1 , 3 ));
816
+ try expectError (error .Fail , lua .getIndexUserValue (1 , 3 ));
817
817
818
818
try expectEqual (data , ziglua .opaqueCast (Data , try lua .toUserdata (1 )));
819
819
try expectEqual (@ptrCast (* const anyopaque , data ), @alignCast (@alignOf (Data ), try lua .toPointer (1 )));
@@ -937,7 +937,7 @@ test "raise error" {
937
937
}.inner ;
938
938
939
939
lua .pushFunction (ziglua .wrap (makeError ));
940
- try expectError (Error .Runtime , lua .protectedCall (0 , 0 , 0 ));
940
+ try expectError (error .Runtime , lua .protectedCall (0 , 0 , 0 ));
941
941
try expectEqualStrings ("makeError made an error" , try lua .toBytes (-1 ));
942
942
}
943
943
@@ -1073,7 +1073,7 @@ test "debug upvalues" {
1073
1073
try lua .getGlobal ("addone" );
1074
1074
1075
1075
// index doesn't exist
1076
- try expectError (Error .Fail , lua .getUpvalue (1 , 2 ));
1076
+ try expectError (error .Fail , lua .getUpvalue (1 , 2 ));
1077
1077
1078
1078
// inspect the upvalue (should be x)
1079
1079
try expectEqualStrings ("x" , try lua .getUpvalue (-1 , 1 ));
@@ -1085,7 +1085,7 @@ test "debug upvalues" {
1085
1085
try lua .setUpvalue (-2 , 1 );
1086
1086
1087
1087
// test a bad index (the valid one's result is unpredicable)
1088
- try expectError (Error .Fail , lua .upvalueId (-1 , 2 ));
1088
+ try expectError (error .Fail , lua .upvalueId (-1 , 2 ));
1089
1089
1090
1090
// call the new function (should return 7)
1091
1091
lua .pushNumber (2 );
@@ -1109,7 +1109,7 @@ test "getstack" {
1109
1109
var lua = try Lua .init (testing .allocator );
1110
1110
defer lua .deinit ();
1111
1111
1112
- try expectError (Error .Fail , lua .getStack (1 ));
1112
+ try expectError (error .Fail , lua .getStack (1 ));
1113
1113
1114
1114
const function = struct {
1115
1115
fn inner (l : * Lua ) i32 {
@@ -1225,7 +1225,7 @@ test "get global fail" {
1225
1225
var lua = try Lua .init (testing .allocator );
1226
1226
defer lua .deinit ();
1227
1227
1228
- try expectError (Error .Fail , lua .getGlobal ("foo" ));
1228
+ try expectError (error .Fail , lua .getGlobal ("foo" ));
1229
1229
}
1230
1230
1231
1231
test "metatables" {
0 commit comments