The simplet Reference Manual

This is the simplet Reference Manual, version 1.2.0, generated automatically by Declt version 4.0 beta 2 "William Riker" on Sun Dec 15 07:42:43 2024 GMT+0.

Table of Contents


1 Introduction


2 Systems

The main system appears first, followed by any subsystem dependency.


2.1 simplet

Simple test runner in Common Lisp.

Maintainer

noloop <>

Author

noloop <>

Home Page

https://github.com/noloop/simplet

Source Control

(GIT git@github.com:noloop/simplet.git)

Bug Tracker

https://github.com/noloop/simplet/issues

License

GPLv3

Long Description

# simplet

### _Simple test runner in Common Lisp._

## Getting Started in simplet

### Portability

I believe it works in all implementations, but I only tested the one I use, which is the SBCL.

### Dependencies

No dependency.

### Download and load

**1 - Load simplet system by quicklisp**

“‘
(ql:quickload :simplet)
“‘

**2 - Download and load simplet system by github and asdf**

Download directly from github:

“‘
git clone https://github.com/noloop/simplet.git
“‘

and load by ASDF:

“‘lisp
(asdf:load-system :simplet)
“‘

_**Note: Remember to configure asdf to find your directory where you downloaded the libraries (asdf call them "systems") above, if you do not know how to make a read at: https://common-lisp.net/project/asdf/asdf/Configuring-ASDF-to-find-your-systems.html or https://lisp-lang.org/learn/writing-libraries.**_

## Create suite and test

“‘lisp
SIMPLET> (suite "Suite 1"
(test "Test one equal one" #’(lambda () (= 1 1)))
(test "Test two equal two" #’(lambda () (= 2 2))))
SIMPLET> (suite "Suite 2"
(test "Test three equal three" #’(lambda () (= 3 3))))
“‘
## Run tests

“‘lisp
SIMPLET> (run)
#...Simplet...#

Test one equal one: T
Test two equal two: T
Suite 1: T

Test three equal three: T
Suite 2: T

Runner result: T

NIL
“‘

You also can getting an string of run, instead of printing on REPL:

“‘lisp
SIMPLET> (run :return-string-p t)
NIL
“‘
## Suites and tests PENDING(or also called TODO)

It’s simple to add a suite or test PENDING. To the suites, just do not add tests to it. To the tests just do not add a test function. Suites and tests PENDING do not make the runner result fail, however they are marked with PENDING instead of T. See the example below:

“‘lisp
SIMPLET> (suite "Suite 1"
(test "Test one equal one" #’(lambda () (= 1 1)))
(test "Test two equal two"))
SIMPLET> (suite "Suite 2")

SIMPLET> (run)
#...Simplet...#

Test one equal one: T
Test two equal two: PENDING
Suite 1: T

Suite 2: PENDING

Runner result: T

NIL
“‘

## Suites and tests only/skip

For suites only:

“‘lisp
SIMPLET> (suite-only "Suite 1"
(test "Test one equal one" #’(lambda () (= 1 1)))
(test "Test two equal two" #’(lambda () (= 2 2))))
SIMPLET> (suite "Suite 2"
(test "Test three equal three" #’(lambda () (= 3 3))))

SIMPLET> (run)
#...Simplet...#

Test one equal one: T
Test two equal two: T
Suite 1: T

Runner result: T

NIL
“‘

For tests only:

“‘lisp
SIMPLET> (suite "Suite 1"
(test-only "Test one equal one" #’(lambda () (= 1 1)))
(test "Test two equal two" #’(lambda () (= 2 2))))
SIMPLET> (suite "Suite 2"
(test-only "Test three equal three" #’(lambda () (= 3 3))))

SIMPLET> (run)
#...Simplet...#

Test one equal one: T
Suite 1: T

Test three equal three: T
Suite 2: T

Runner result: T

NIL
“‘

For suites skip:

“‘lisp
SIMPLET> (suite-skip "Suite 1"
(test "Test one equal one" #’(lambda () (= 1 1)))
(test "Test two equal two" #’(lambda () (= 2 2))))
SIMPLET> (suite "Suite 2"
(test "Test three equal three" #’(lambda () (= 3 3))))

SIMPLET> (run)
#...Simplet...#

Test three equal three: T
Suite 2: T

Runner result: T

NIL
“‘

For tests skip:

“‘lisp
SIMPLET> (suite "Suite 1"
(test-skip "Test one equal one" #’(lambda () (= 1 1)))
(test "Test two equal two" #’(lambda () (= 2 2))))
SIMPLET> (suite "Suite 2"
(test-skip "Test three equal three" #’(lambda () (= 3 3))))

SIMPLET> (run)
#...Simplet...#

Test two equal two: T
Suite 1: T

Suite 2: T

Runner result: T

NIL
“‘

Beware of traps when mixing only and skip:

“‘lisp
SIMPLET> (suite-skip "Suite 1"
(test-only "Test one equal one" #’(lambda () (= 1 1)))
(test "Test two equal two" #’(lambda () (= 2 2))))
SIMPLET> (suite "Suite 2"
(test "Test three equal three" #’(lambda () (= 3 3))))

SIMPLET> (run)
#...Simplet...#

Runner result: T

NIL
“‘
## ASDF integration

Do not forget to add ‘:defsystem-depends-on (:simplet-asdf)‘ to ‘your-app.asd‘ system definition file, this will enable‘:test-file‘ in the ‘:components‘. The class ‘:test-file‘ is similar to‘:file‘ except it will be loaded only when call ‘asdf:test-system‘. See an example below:

“‘lisp
(defsystem :your-app
;; ...
:in-order-to ((test-op (test-op your-app/test))))

(defsystem :your-app/test
:author "your <your@youremail.com>"
:depends-on (:your-app :simplet)
:defsystem-depends-on (:simplet-asdf)
:components ((:module "test"
:components
((:test-file "your-app-test"))))
:perform (test-op (op c) (symbol-call :simplet ’#:run)))

“‘

To run tests with ASDF:

“‘lisp
(asdf:test-system :your-app)
“‘

## Limitations

* Whitout cacth error
* Solely synchronous tests
* Whitout fixtures
* Whitout timeout
* Without recursives suites
* Without assertion libraries integration
* Not possible execution of tests whitout suites(because not contain the concept of root-suite.)

## API

function **(suite description &rest tests)**

function **(suite-only description &rest tests)**

function **(suite-skip description &rest tests)**

function **(test description &optional fn)**

function **(test-only description &optional fn)**

function **(test-skip description &optional fn)**

function **(run &key return-string-p)**

Version

1.2.0

Source

simplet.asd.

Child Component

src (module).


3 Modules

Modules are listed depth-first from the system components tree.


3.1 simplet/src

Source

simplet.asd.

Parent Component

simplet (system).

Child Components

4 Files

Files are sorted by type and then listed depth-first from the systems components trees.


4.1 Lisp


4.1.1 simplet/simplet.asd

Source

simplet.asd.

Parent Component

simplet (system).

ASDF Systems

simplet.


4.1.2 simplet/src/asdf.lisp

Source

simplet.asd.

Parent Component

src (module).

Packages

simplet-asdf.

Public Interface

4.1.3 simplet/src/package.lisp

Dependency

asdf.lisp (file).

Source

simplet.asd.

Parent Component

src (module).

Packages

noloop.simplet.


4.1.4 simplet/src/simplet.lisp

Dependency

package.lisp (file).

Source

simplet.asd.

Parent Component

src (module).

Public Interface
Internals

5 Packages

Packages are listed by definition order.


5.1 simplet-asdf

Source

asdf.lisp.

Use List
  • asdf/interface.
  • common-lisp.
Public Interface

test-file (class).


5.2 noloop.simplet

Source

package.lisp.

Nickname

simplet

Use List

common-lisp.

Public Interface
Internals

6 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


6.1 Public Interface


6.1.1 Ordinary functions

Function: run (&key return-string-p)
Package

noloop.simplet.

Source

simplet.lisp.

Function: suite (description &rest tests)
Package

noloop.simplet.

Source

simplet.lisp.

Function: suite-only (description &rest tests)
Package

noloop.simplet.

Source

simplet.lisp.

Function: suite-skip (description &rest tests)
Package

noloop.simplet.

Source

simplet.lisp.

Function: test (description &optional fn)
Package

noloop.simplet.

Source

simplet.lisp.

Function: test-only (description &optional fn)
Package

noloop.simplet.

Source

simplet.lisp.

Function: test-skip (description &optional fn)
Package

noloop.simplet.

Source

simplet.lisp.


6.1.2 Standalone methods

Method: operation-done-p ((op compile-op) (c test-file))
Package

asdf/action.

Source

asdf.lisp.

Method: operation-done-p ((op load-op) (c test-file))
Package

asdf/action.

Source

asdf.lisp.


6.1.3 Classes

Class: test-file
Package

simplet-asdf.

Source

asdf.lisp.

Direct superclasses

cl-source-file.

Direct methods

6.2 Internals


6.2.1 Ordinary functions

Function: clear-suites ()
Package

noloop.simplet.

Source

simplet.lisp.

Function: collect-suites-only (suites)
Package

noloop.simplet.

Source

simplet.lisp.

Function: collect-tests-only (tests)
Package

noloop.simplet.

Source

simplet.lisp.

Function: create-list-suite-result (description tests only skip)
Package

noloop.simplet.

Source

simplet.lisp.

Function: create-suite (description tests &key only skip)
Package

noloop.simplet.

Source

simplet.lisp.

Function: create-test (description fn &key only skip)
Package

noloop.simplet.

Source

simplet.lisp.

Function: get-suites ()
Package

noloop.simplet.

Source

simplet.lisp.

Function: reporter (runner-result &key return-string-p)
Package

noloop.simplet.

Source

simplet.lisp.

Function: run-suites (suites)
Package

noloop.simplet.

Source

simplet.lisp.


Appendix A Indexes


A.1 Concepts


A.2 Functions

Jump to:   C   F   G   M   O   R   S   T  
Index Entry  Section

C
clear-suites: Private ordinary functions
collect-suites-only: Private ordinary functions
collect-tests-only: Private ordinary functions
create-list-suite-result: Private ordinary functions
create-suite: Private ordinary functions
create-test: Private ordinary functions

F
Function, clear-suites: Private ordinary functions
Function, collect-suites-only: Private ordinary functions
Function, collect-tests-only: Private ordinary functions
Function, create-list-suite-result: Private ordinary functions
Function, create-suite: Private ordinary functions
Function, create-test: Private ordinary functions
Function, get-suites: Private ordinary functions
Function, reporter: Private ordinary functions
Function, run: Public ordinary functions
Function, run-suites: Private ordinary functions
Function, suite: Public ordinary functions
Function, suite-only: Public ordinary functions
Function, suite-skip: Public ordinary functions
Function, test: Public ordinary functions
Function, test-only: Public ordinary functions
Function, test-skip: Public ordinary functions

G
get-suites: Private ordinary functions

M
Method, operation-done-p: Public standalone methods
Method, operation-done-p: Public standalone methods

O
operation-done-p: Public standalone methods
operation-done-p: Public standalone methods

R
reporter: Private ordinary functions
run: Public ordinary functions
run-suites: Private ordinary functions

S
suite: Public ordinary functions
suite-only: Public ordinary functions
suite-skip: Public ordinary functions

T
test: Public ordinary functions
test-only: Public ordinary functions
test-skip: Public ordinary functions


A.3 Variables