Running unit tests - chung-leong/zigar GitHub Wiki

Use the CLI utility to run unit tests embedded in your Zig files:

npx zigar test zig/hello.zig

By default, the test code will target the same OS and CPU archecture as the computer running the compiler, with optimization level set to Debug. Use the -D flag to change these settings:

npx zigar test zig/hello.zig -Dtarget=aarch64-linux -Doptimize=ReleaseSmall

Use the --summary flag if you wish to see a summary of the tests' outcome:

npx zigar test zig/hello.zig --summary all
Build Summary: 3/3 steps succeeded; 4/4 tests passed
test success
└─ run test 4 passed 801us MaxRSS:1M
   └─ compile test Debug native success 899ms MaxRSS:121M