No, the test code is not included in release builds. The Zig compiler is quite aggressive when it comes to not including anything that's not needed in a release build. In fact, it doesn't even evaluate functions that are never called!
At the moment it's a "build your own" type of situation (and maybe it'll stay that way given Zig's emphasis on keeping lean and simple) but building a table of structs and looping over them is pretty simple so the friction is low.
Great video again! I noticed when you showed the build.zig file that (it seems) you had a init-lib type of project in this case. in my build.zig file from an init-exe I did not have this line where you can filter the tests. Maybe it can be added, I did not try, as I got your point. :-)
Interestingly, in the 0.12 development version, they removed the split between init-exe and init-lib and now there's just one `int` that produces main.zig for an executable and root.zig for a library, and a build.zig that works for both. You can then add and remove as needed by your project.
Is the test code included when compiling a release build? Or put differently, is there a way to not compiling the test code when building a release?
No, the test code is not included in release builds. The Zig compiler is quite aggressive when it comes to not including anything that's not needed in a release build. In fact, it doesn't even evaluate functions that are never called!
Nice video, thank you! I know it's pretty simple to create it on our own, but does zig testing system also provides a table testing mechanism?
At the moment it's a "build your own" type of situation (and maybe it'll stay that way given Zig's emphasis on keeping lean and simple) but building a table of structs and looping over them is pretty simple so the friction is low.
Great video again!
I noticed when you showed the build.zig file that (it seems) you had a init-lib type of project in this case. in my build.zig file from an init-exe I did not have this line where you can filter the tests. Maybe it can be added, I did not try, as I got your point. :-)
Interestingly, in the 0.12 development version, they removed the split between init-exe and init-lib and now there's just one `int` that produces main.zig for an executable and root.zig for a library, and a build.zig that works for both. You can then add and remove as needed by your project.
Promo'SM ☀️