Skip to content

Navigation Menu

Sign in
Sign up

Repository files navigation

📖 Testament

Doc tests for gleam! ✨

Package Version Hex Docs

gleam add --dev testament

Usage:

Write some beautiful gleam code with Doc Comments 📒 (or Markdown!)

More info on Writing Tests 🔗

////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

import gleeunit
import testament
pub fn main() -> Nil {
 testament.test_main(gleeunit.main)
}

✨ Enjoy

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)

echo -e "\ntest/testament/*" >> .gitignore

If running with Deno

[javascript.deno]
allow_read = true
allow_write = true
allow_env = ["TESTAMENT_WITH_DOCS", "PATHEXT", "PATH"]
allow_run = ["gleam"]

About

Doc tests for gleam! ✨

Topics

Resources

Stars

9 stars

Watchers

0 watching

Forks

Contributors

Languages

AltStyle によって変換されたページ (->オリジナル) /