Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kristoff-it/zig-doctest
A tool for testing snippets of code, useful for websites and books that talk about Zig.
https://github.com/kristoff-it/zig-doctest
Last synced: 9 days ago
JSON representation
A tool for testing snippets of code, useful for websites and books that talk about Zig.
- Host: GitHub
- URL: https://github.com/kristoff-it/zig-doctest
- Owner: kristoff-it
- License: mit
- Created: 2020-11-03T15:35:48.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2024-05-27T21:30:14.000Z (5 months ago)
- Last Synced: 2024-10-24T15:29:09.906Z (15 days ago)
- Language: Zig
- Size: 183 KB
- Stars: 76
- Watchers: 5
- Forks: 22
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-zig - kristoff-it/zig-doctest
- awesome-zig - zig-doctest๐๏ธA tool for testing snippets of code, useful for websites and books that talk about Zig
README
# 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"
```