An open API service indexing awesome lists of open source software.

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

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

![2024-11-2022-41-22-ezgif com-video-to-gif-converter (1)](https://github.com/user-attachments/assets/54c511fc-3d44-42b0-9e52-c45ba5018558)