Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pyrmont/testament
A testing library for Janet
https://github.com/pyrmont/testament
janet testing
Last synced: about 2 months ago
JSON representation
A testing library for Janet
- Host: GitHub
- URL: https://github.com/pyrmont/testament
- Owner: pyrmont
- License: mit
- Created: 2020-05-06T20:36:22.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-06-15T09:03:51.000Z (over 1 year ago)
- Last Synced: 2024-08-04T04:01:06.726Z (5 months ago)
- Topics: janet, testing
- Language: Janet
- Homepage:
- Size: 92.8 KB
- Stars: 27
- Watchers: 3
- Forks: 7
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-janet - Testament
README
# Testament
[![Build Status](https://github.com/pyrmont/testament/workflows/build/badge.svg)](https://github.com/pyrmont/testament/actions?query=workflow%3Abuild)
Testament is a testing library for Janet. It takes inspiration from Joy's
[Tester][] library and Clojure's [clojure.test][] library.[Tester]: https://github.com/joy-framework/tester
[clojure.test]: https://clojure.github.io/clojure/clojure.test-api.html## Installation
Add the dependency to your `project.janet` file:
```clojure
(declare-project
:dependencies ["https://github.com/pyrmont/testament"])
```## Usage
Testament can be used like this:
```clojure
(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:
```console
$ jpm test
```If you do the above with a file saved to `test/example.janet`, you should see:
```text
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][api].
[api]: https://github.com/pyrmont/testament/blob/master/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.[Issues]: https://github.com/pyrmont/testament/issues
## Licence
Testament is licensed under the MIT Licence. See [LICENSE][] for more details.
[LICENSE]: https://github.com/pyrmont/testament/blob/master/LICENSE