Zig course

Zig Level 9: Testing & Debugging

Testing & Debugging is level 9 of 11 of the LoWisa Zig course. It has 3 lessons and 9 ideas. Below is every lesson and what it teaches, in one line each.

Updated 2026-11-25

Built-In Testing

  • test blocks. Tests are test blocks in the source file: zig build test running them all.
  • std.testing. std.testing asserts equality and errors: with the testing allocator watching memory.
  • Doctests by proximity. Tests beside the code they pin: the file is implementation, contract and proof together.

Debugging Native Programs

  • Debug builds. Debug builds keep safety checks on: bounds, overflow, unreachable: crashes at the true line.
  • Stack traces. Panics print full traces: including error return traces on failure paths.
  • Debuggers. Native debuggers work as on C: breakpoints, memory views, the systems toolkit intact.

Safety Modes

  • Release modes. Zig ships modes: Debug, ReleaseSafe, ReleaseFast, ReleaseSmall: safety chosen per build.
  • ReleaseSafe honestly. ReleaseSafe keeps checks in production: the default worth defending until profiles argue.
  • undefined behaviour named. Zig names its UB and checks it in safe modes: unreachable is a promise, tested.

Before and after this level

In the app each of these ideas is taught and then asked back, and the level ends with a checkpoint and flashcards. See Checkpoints and flashcards.

Frequently asked questions

What does Zig Level 9: Testing & Debugging cover?

Built-In Testing, Debugging Native Programs, Safety Modes: 3 lessons and 9 ideas.

What should I know before this level?

The level before it, Level 8: C Interoperability, which covers Calling C, Exporting Zig, Replacing or Extending C Components.

Learn Zig on your phone

The first level is free. LoWisa is on Google Play and the App Store.