Skip to content

A tool for testing snippets of code, useful for websites and books that talk about Zig.

License

Notifications You must be signed in to change notification settings

squeek502/zig-doctest

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

54 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Doctest

A tool for testing snippets of code, useful for websites and books that talk about Zig.

Abstract

Doctest is a code rendering tool that on top of providing syntax highlighting it also can run your code snippets to ensure that they behave as expected.

Other than the syntax highlighting, this tool gives you the option of testing scripts that are expected to fail. This is something that the built-in testing framework of Zig doesn't allow to do in the same way. This is particularly useful when demoing things like runtime checks in safe release modes, which will cause the executable to crash.

Building

$ zig build 

Usage

Available commands: syntax, build, test, run, inline, help.

Put the `--help` flag after the command to get command-specific
help.

Examples:

 ./doctest syntax --in_file=foo.zig
 ./doctest build --obj --fail "not handled in switch"
 ./doctest test --out_file bar.zig --zig_exe="/Downloads/zig/bin/zig"

About

A tool for testing snippets of code, useful for websites and books that talk about Zig.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Zig 99.9%
  • AMPL 0.1%