https://github.com/bwireman/testament
Doc tests for gleam! ✨
https://github.com/bwireman/testament
beam doc-tests doctests documentation erlang gleam javascript tests tooling
Last synced: 10 months ago
JSON representation
Doc tests for gleam! ✨
- Host: GitHub
- URL: https://github.com/bwireman/testament
- Owner: bwireman
- License: mit
- Created: 2025-08-01T23:11:09.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2025-08-16T17:42:20.000Z (10 months ago)
- Last Synced: 2025-08-16T18:34:40.581Z (10 months ago)
- Topics: beam, doc-tests, doctests, documentation, erlang, gleam, javascript, tests, tooling
- Language: Gleam
- Homepage: https://hex.pm/packages/testament
- Size: 52.7 KB
- Stars: 4
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 📖 Testament
Doc tests for gleam! ✨
[](https://hex.pm/packages/testament)
[](https://hexdocs.pm/testament/)
```sh
gleam add --dev testament
```
## Usage:
### Write some beautiful gleam code with Doc Comments 📒 (or Markdown!)
More info on [Writing Tests 🔗](https://hexdocs.pm/testament/writing_tests.html)
````gleam
////Example Module doc test
////```gleam
////: assert 1 + 1 == 2
////```
///Example function doc test
///adds two Ints
///```gleam
///: assert example.add(1, 2) == 3
///: assert example.add(1, -1) == 0
///```
pub fn add(a: Int, b: Int) -> Int {
a + b
}
````
### Add testament to your test's main function
```gleam
import gleeunit
import testament
pub fn main() -> Nil {
testament.test_main(gleeunit.main)
}
```
### ✨ Enjoy
```bash
gleam test
Compiling example
Compiled in 0.44s
Running example_test.main
.
1 test, no failures
```
### Note
#### If seeing files you don't want checked in
(these should get deleted after the run)
```bash
echo -e "\ntest/testament/*" >> .gitignore
```
#### If running with Deno
```toml
[javascript.deno]
allow_read = true
allow_write = true
allow_env = ["TESTAMENT_WITH_DOCS", "PATHEXT", "PATH"]
allow_run = ["gleam"]
```