Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/lambdabaa/lunit

A lightweight Lisp unit testing library. This is... a work in progress.
https://github.com/lambdabaa/lunit

Last synced: 7 days ago
JSON representation

A lightweight Lisp unit testing library. This is... a work in progress.

Awesome Lists containing this project

README

        

lunit
=====

A lightweight Lisp unit testing library. This is... a work in progress.

### Example

```lisp
(load (merge-pathnames "fixtures/calculator" *load-truename*))
(use-package :calculator)
(load (merge-pathnames "../src/lunit" *load-truename*))
(use-package :lunit)

(create-suite "calculator" (lambda (suite)
(setup suite (lambda ()
(calculator:reset)
))

(test suite "should add correctly" (lambda ()
(assert (= 0 (calculator:value)))
(calculator:add 5)
(assert (= 5 (calculator:value)))
(calculator:add 5)
(assert (= 10 (calculator:value)))
))

(test suite "reset should set accumulator to 0" (lambda ()
(assert (= 0 (calculator:value)))
(calculator:add 2)
(assert (/= 0 (calculator:value)))
(calculator:reset)
(assert (= 0 (calculator:value)))
))

(test suite "assertion fail" (lambda ()
(assert (= 1 (calculator:value)))
))
))
```