Testament is a testing library for Janet. It takes inspiration from Joy's Tester library and Clojure's clojure.test library.
Add the dependency to your project.janet
file:
(declare-project
:dependencies ["https://github.com/pyrmont/testament"])
Testament can be used like this:
(import testament :prefix "" :exit true)
(deftest one-plus-one
(is (= 2 (+ 1 1)) "1 + 1 = 2"))
(deftest two-plus-two
(is (= 5 (+ 2 2)) "2 + 2 = 5")))
(run-tests!)
Put your tests in the test/
directory within your project and then run:
$ jpm test
If you do the above with a file saved to test/example.janet
, you should see:
running test/example.janet ...
> Failed: two-plus-two
Assertion: 2 + 2 = 5
Expect: 5
Actual: 4
-----------------------------------
2 tests run containing 2 assertions
1 tests passed, 1 tests failed
-----------------------------------
Documentation for Testament's API is in api.md.
Found a bug? I'd love to know about it. The best way is to report your bug in the Issues section on GitHub.
Testament is licensed under the MIT Licence. See LICENSE for more details.