This document describes the remaining changes needed to make the framework fully compatible with Zig 0.15.1.
The framework is ~95% complete. The build system is fully updated for Zig 0.15.1. Only ArrayList API changes remain.
In Zig 0.15.1, the ArrayList API changed significantly:
OLD (Zig 0.13):
var list = std.ArrayList(T).init(allocator);
defer list.deinit();
try list.append(item);NEW (Zig 0.15.1):
var list: std.ArrayList(T) = .empty;
defer list.deinit(allocator); // allocator now required
try list.append(allocator, item); // allocator now required-
src/suite.zig (7 locations)
- Line 65-70: TestSuite.init() method
- Line 122: getAllBeforeEachHooks() method
- Line 139: getAllAfterEachHooks() method
- Line 207: TestRegistry.init() method
-
src/mock.zig (2 locations)
- Line 38-39: Mock.init() method
-
src/reporter.zig (1 location)
- Line 396: JsonReporter.init() method
-
src/test_runner.zig (1 location)
- Line 46-47: Need to use std.fs.File.getStdOut() instead of std.io.getStdOut()
For each file, replace:
.field = std.ArrayList(Type).init(allocator),With:
.field = .empty,And update .deinit() calls:
// OLD
self.field.deinit();
// NEW
self.field.deinit(self.allocator);And update .append() calls:
// OLD
try self.field.append(item);
// NEW
try self.field.append(self.allocator, item);Before:
pub fn init(allocator: std.mem.Allocator) !*Self {
const suite = try allocator.create(Self);
suite.* = Self{
.name = name,
.tests = std.ArrayList(TestCase).init(allocator), // OLD
.allocator = allocator,
};
return suite;
}
pub fn deinit(self: *Self) void {
self.tests.deinit(); // OLD
}
pub fn addTest(self: *Self, test_case: TestCase) !void {
try self.tests.append(test_case); // OLD
}After:
pub fn init(allocator: std.mem.Allocator) !*Self {
const suite = try allocator.create(Self);
suite.* = Self{
.name = name,
.tests = .empty, // NEW
.allocator = allocator,
};
return suite;
}
pub fn deinit(self: *Self) void {
self.tests.deinit(self.allocator); // NEW
}
pub fn addTest(self: *Self, test_case: TestCase) !void {
try self.tests.append(self.allocator, test_case); // NEW
}The build.zig is fully updated for Zig 0.15.1:
- Uses
b.createModule()with.root_modulefor executables - Uses
.importsarray for module dependencies - Uses
b.addModule()for library exports - All test configurations updated
- ✅ Build system (build.zig, build.zig.zon)
- ✅ Core framework architecture
- ✅ All 9 framework modules implemented
- ✅ Assertions library with 20+ matchers
- ✅ Test suite management (describe/it/hooks)
- ✅ 3 reporters (Spec, Dot, JSON)
- ✅ Mock/Spy functionality
- ✅ CLI parser
- ✅ Matchers (struct, array, float)
- ✅ Examples (basic & advanced)
- ✅ Test stubs for all modules
- ✅ Comprehensive documentation
To fix all ArrayList issues at once, you can run:
# Replace .init(allocator) with .empty
sed -i '' 's/std\.ArrayList(\([^)]*\))\.init(allocator)/.empty/g' src/suite.zig src/mock.zig src/reporter.zig
# Then manually update deinit() and append() calls to pass allocatorAbout 15-30 minutes to manually update all ArrayList calls across the codebase.
zig build # Should compile successfully
zig build test # Run all tests
zig build examples # Run example testsFramework Status: 95% Complete Remaining Work: ArrayList API updates only Lines of Code: ~3,000+ Documentation: Complete