running zig test on the following file will fail:
const std = @import("std");
pub fn main() !void {}
var global: u8 = 0;
test "test a" {
try std.testing.expect(global == 0);
global += 1;
}
test "test b" {
try std.testing.expect(global == 0);
global += 1;
}
Question is, is there a way to isolate test from eachother when those tests rely on global state? Of course I can attempt to write tests in a way that clean up their global state, I'm just worried about a possible future scenario where a badly written test a causes test b to fail, and then I'm chasing ghosts wondering what went wrong in test b. This is a trivial example, but for a larger program with more global state it could be an issue.
Thanks!