Skip to content

pyrmont/testament

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

95 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 (L): 5
Actual (R): 4

-----------------------------------
2 tests run containing 2 assertions
1 tests passed, 1 tests failed
-----------------------------------

In REPLs

To use Testament in a REPL, set the dynamic variable :testament-repl? to true:

(setdyn :testament-repl? true)

This will (a) stop Testament from exiting your REPL if a test fails, (b) reset the reports between runs and (c) empty the module/cache to prevent old code from running.

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

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages