roobie / testament

A testing library for Janet

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Testament

Build Status

Testament is a testing library for Janet. It takes inspiration from Joy's Tester library and Clojure's clojure.test library.

Installation

Add the dependency to your project.janet file:

(declare-project
  :dependencies ["https://github.com/pyrmont/testament"])

Usage

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

API

Documentation for Testament's API is in api.md.

Bugs

Found a bug? I'd love to know about it. The best way is to report your bug in the Issues section on GitHub.

Licence

Testament is licensed under the MIT Licence. See LICENSE for more details.

About

A testing library for Janet

License:MIT License