@@ -1825,7 +1825,6 @@ test "StrBuf integration with Table operations" {
18251825 try expectEq (lua .top (), 0 );
18261826}
18271827
1828-
18291828// Define a Zig function that builds and returns StrBuf by pointer
18301829fn makeMsg (l : * Lua , name : []const u8 , value : i32 ) ! Lua.StrBuf {
18311830 var buf : Lua.StrBuf = undefined ;
@@ -1863,7 +1862,7 @@ fn makeMsgTuple(l: *Lua, name: []const u8, value: i32) !struct { Lua.StrBuf, i32
18631862 buf .addLString (name );
18641863 buf .addString (" = " );
18651864 try buf .add (value );
1866-
1865+
18671866 return .{ buf , value * 2 };
18681867}
18691868
@@ -1880,7 +1879,7 @@ test "StrBuf returned in tuple from Zig functions" {
18801879
18811880 // Call function that returns tuple (StrBuf, i32)
18821881 const result = try lua .eval ("return makeTuple('test', 21)" , .{}, struct { []const u8 , i32 });
1883-
1882+
18841883 const expected_str = "Tuple: test = 21" ;
18851884 try expectEq (std .mem .startsWith (u8 , result [0 ], expected_str ), true );
18861885 try expectEq (result [1 ], 42 );
@@ -1890,18 +1889,18 @@ test "StrBuf returned in tuple from Zig functions" {
18901889fn makeLargeMsg (l : * Lua , count : i32 ) ! Lua.StrBuf {
18911890 var buf : Lua.StrBuf = undefined ;
18921891 buf .init (l );
1893-
1892+
18941893 // Build a string longer than LUA_BUFFERSIZE (512 bytes) to force dynamic allocation
18951894 buf .addString ("Large message: " );
1896-
1895+
18971896 // Add enough content to exceed buffer size
18981897 var i : i32 = 0 ;
18991898 while (i < count ) : (i += 1 ) {
19001899 buf .addString ("This is a repeated string to exceed buffer size! " );
19011900 try buf .add (i );
19021901 buf .addString (" " );
19031902 }
1904-
1903+
19051904 return buf ;
19061905}
19071906
@@ -1915,12 +1914,12 @@ test "StrBuf with dynamic allocation returned from Zig functions" {
19151914 // Test with enough iterations to exceed 512 bytes
19161915 // Each iteration adds ~50+ bytes, so 15 iterations should exceed 512 bytes
19171916 const result = try lua .eval ("return makeLarge(15)" , .{}, []const u8 );
1918-
1917+
19191918 // Verify the result starts correctly and is reasonably long
19201919 try expectEq (std .mem .startsWith (u8 , result , "Large message: This is a repeated string" ), true );
19211920 try expectEq (result .len > 512 , true ); // Should be longer than buffer size
1922-
1921+
19231922 // Verify it contains content from both early and late iterations
1924- try expectEq (std .mem .indexOf (u8 , result , "0 " ) != null , true ); // First iteration
1923+ try expectEq (std .mem .indexOf (u8 , result , "0 " ) != null , true ); // First iteration
19251924 try expectEq (std .mem .indexOf (u8 , result , "14 " ) != null , true ); // Last iteration
19261925}
0 commit comments