Something confuses me with the combination usage of @import("root")
and
builtin.test_functions
in zig.
When I declare a root T
class in the custom test runner here, the type
comparison with the original Foo
struct works in the main function, but
doesn't work in a function run via builting.test_functions
.
I reproduce the issue with Zig current master (0.12.0-dev.3193+4ba4f94c9
).
$ zig build test
type comparison in main function OK
root.test.type comparison in test function FAIL
error: TestUnexpectedResult
/usr/local/zig/lib/std/testing.zig:540:14: 0x1033adf in expect (test)
if (!ok) return error.TestUnexpectedResult;
^
/home/pierre/prs/learnzig/type-compare/src/root.zig:26:5: 0x1033bf5 in test.type comparison in test function (test)
try std.testing.expect(Foo == Root_T); // doesn't work.
^
/home/pierre/prs/learnzig/type-compare/src/root.zig:19:13: 0x103437e in main (test)
return err;
^
/home/pierre/prs/learnzig/type-compare/src/test_runner.zig:8:5: 0x1034d13 in main (test)
try root.main();
^
test
└─ run test failure