Tripwire is a single-file Zig library for testing error recovery paths by injecting failures at named points in code. It enables testing of errdefer statements, which are difficult to exercise otherwise, by allowing developers to trigger errors at specific locations during tests. The library has zero runtime cost outside tests through compile-time optimization and inlining. When integrated into Ghostty, it immediately uncovered six previously unknown errdefer bugs, all now fixed with accompanying unit tests.
1 Comment
Sort: