A poolable string builder (aka string buffer) for Zig
0

Configure Feed

Select the types of activity you want to include in your feed.

add tests for cString

Karl Seguin (Jan 31, 2025, 8:40 AM +0800) 05a38de6 a50d5e7c

+12
+12
src/buffer.zig
··· 552 552 try t.expectString("hello 123 world", w.string()); 553 553 } 554 554 555 + test "cString" { 556 + var w = try Buffer.init(t.allocator, 10); 557 + defer w.deinit(); 558 + try t.expectString("", try w.cString()); 559 + 560 + try w.write("123456789"); 561 + try t.expectString("123456789", try w.cString()); 562 + 563 + try w.write("0"); 564 + try t.expectString("1234567890", try w.cString()); 565 + } 566 + 555 567 fn testString(allocator: Allocator, random: std.Random) []const u8 { 556 568 var s = allocator.alloc(u8, random.uintAtMost(u8, 100) + 1) catch unreachable; 557 569 for (0..s.len) |i| {