https://github.com/codereport/bqn-test
A simple unit testing library for BQN
https://github.com/codereport/bqn-test
Last synced: 4 months ago
JSON representation
A simple unit testing library for BQN
- Host: GitHub
- URL: https://github.com/codereport/bqn-test
- Owner: codereport
- License: mit
- Created: 2024-08-26T18:29:20.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2025-02-15T20:24:46.000Z (over 1 year ago)
- Last Synced: 2025-02-15T21:24:52.985Z (over 1 year ago)
- Language: BQN
- Homepage:
- Size: 42 KB
- Stars: 4
- Watchers: 1
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
#
bqn-test
A simple unit testing library for [BQN](https://mlochbaum.github.io/BQN) (inspired by [pytest](https://docs.pytest.org/en/stable/)).
### Usage
#### Running from the command line
Basic usage shown below:
```bash
bqn-test . # this is quiet mode
bqn-test . -v # this is verbose mode
```
Note, after `git clone`-ing this repo, you will probably want to put the `bqn-test` script on your path:
```bash
export PATH=$PATH:/home/cph/bqn-test
```
#### Using in BQN files
Include the `test.bqn` and then make use of `UnitTest` for passing tests and `UnitFail` if you currently expect the test to fail. In order to get `currently:` results, use match `≡` and the expression preceeding the `≡` will be evaluated.
```bqn
⟨UnitTest, UnitFail⟩ ⇐ •Import "/home/cph/bqn-test/test.bqn"
PlusOne ← { 𝕩+1 }
UnitTest (PlusOne 1) ≡ 2
UnitFail (PlusOne 1) ≡ 3
```
### Demo
