The unit-test Reference Manual

This is the unit-test Reference Manual, generated automatically by Declt version 4.0 beta 2 "William Riker" on Sun Sep 15 07:01:40 2024 GMT+0.

Table of Contents


1 Systems

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


1.1 unit-test

unit-testing framework for common lisp

Source

unit-test.asd.

Child Component

unit-test.lisp (file).


2 Files

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


2.1 Lisp


2.1.1 unit-test/unit-test.asd

Source

unit-test.asd.

Parent Component

unit-test (system).

ASDF Systems

unit-test.

Packages

unit-test.system.


2.1.2 unit-test/unit-test.lisp

Source

unit-test.asd.

Parent Component

unit-test (system).

Packages

unit-test.

Public Interface
Internals

3 Packages

Packages are listed by definition order.


3.1 unit-test

Source

unit-test.lisp.

Use List

common-lisp.

Public Interface
Internals

3.2 unit-test.system

Source

unit-test.asd.

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

4 Definitions

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


4.1 Public Interface


4.1.1 Special variables

Special Variable: *unit-test-debug*

(Setq *unit-test-debug* t) for debugging

Package

unit-test.

Source

unit-test.lisp.


4.1.2 Macros

Macro: define-test-class (class-name &optional slots)

Define a new test class. SLOTS are specified as normal CLOS slots.

Package

unit-test.

Source

unit-test.lisp.

Macro: deftest (unit name &rest body)

Create an instance of a unit test called NAME for UNIT.

Package

unit-test.

Source

unit-test.lisp.

Macro: test-assert (form &optional reason)
Package

unit-test.

Source

unit-test.lisp.

Macro: test-condition (form expected-condition)
Package

unit-test.

Source

unit-test.lisp.

Macro: test-equal (value form &key test)
Package

unit-test.

Source

unit-test.lisp.


4.1.3 Ordinary functions

Function: get-test-by-name (name)
Package

unit-test.

Source

unit-test.lisp.

Function: run-all-tests (&key verbose output unit)
Package

unit-test.

Source

unit-test.lisp.


4.1.4 Generic functions

Generic Function: run-test (test &optional output)
Package

unit-test.

Source

unit-test.lisp.

Methods
Method: run-test ((test unit-test) &optional output)

4.1.5 Standalone methods

Method: initialize-instance :after ((self unit-test) &rest rest &key &allow-other-keys)
Source

unit-test.lisp.

Method: print-object ((result test-result) stream)
Source

unit-test.lisp.

Method: print-object ((self unit-test) stream)
Source

unit-test.lisp.


4.1.6 Classes

Class: test-condition-result
Package

unit-test.

Source

unit-test.lisp.

Direct superclasses

test-result.

Direct methods
Direct slots
Slot: result
Initargs

:result

Readers

test-result-result.

Writers

This slot is read-only.

Class: test-equal-result
Package

unit-test.

Source

unit-test.lisp.

Direct superclasses

test-result.

Direct methods
Direct slots
Slot: value
Initargs

:value

Readers

test-result-value.

Writers

This slot is read-only.

Slot: real-value
Initargs

:real-value

Readers

test-result-real-value.

Writers

This slot is read-only.

Class: test-error-result
Package

unit-test.

Source

unit-test.lisp.

Direct superclasses

test-result.

Direct methods
Direct slots
Slot: error
Package

common-lisp.

Initargs

:error

Readers

test-result-error.

Writers

This slot is read-only.

Class: test-result
Package

unit-test.

Source

unit-test.lisp.

Direct subclasses
Direct methods
Direct slots
Slot: form
Initargs

:form

Readers

test-result-form.

Writers

This slot is read-only.

Slot: status

one of :pass, :fail, :crash

Initargs

:status

Readers

test-result-status.

Writers

This slot is read-only.

Slot: reason
Initargs

:reason

Readers

test-result-reason.

Writers

This slot is read-only.


4.2 Internals


4.2.1 Special variables

Special Variable: *unit-test-results*

Collects the results of the running tests.

Package

unit-test.

Source

unit-test.lisp.

Special Variable: *unit-tests*

This contains all unit tests. Tests are added simply by creating instances of test objects.

Package

unit-test.

Source

unit-test.lisp.


4.2.2 Ordinary functions

Function: delete-all-tests ()

Throw away all tests from test suite.

Package

unit-test.

Source

unit-test.lisp.

Function: delete-tests-for (unit)

Blow away all tests for UNIT from test set.

Package

unit-test.

Source

unit-test.lisp.

Function: test-crashed-p (test)
Package

unit-test.

Source

unit-test.lisp.

Function: test-failed-p (test)
Package

unit-test.

Source

unit-test.lisp.

Function: test-fails (&optional reason)

Used to signal that the test has failed. REASON may be a string or symbol which will be noted in the test report.

Package

unit-test.

Source

unit-test.lisp.

Function: test-passed-p (test)
Package

unit-test.

Source

unit-test.lisp.

Function: test-passes ()

Used to signal that the test has passed.

Package

unit-test.

Source

unit-test.lisp.


4.2.3 Generic functions

Generic Function: print-result (result stream)
Package

unit-test.

Source

unit-test.lisp.

Methods
Method: print-result ((result test-result) stream)
Generic Function: print-result-form (result stream)
Package

unit-test.

Source

unit-test.lisp.

Methods
Method: print-result-form ((result test-condition-result) stream)
Method: print-result-form ((result test-error-result) stream)
Method: print-result-form ((result test-equal-result) stream)
Method: print-result-form ((result test-assert-result) stream)
Method: print-result-form ((result test-result) stream)
Generic Function: print-result-status (result status stream)
Package

unit-test.

Source

unit-test.lisp.

Methods
Method: print-result-status ((result test-equal-result) (status (eql :fail)) stream)
Method: print-result-status ((result test-condition-result) (status (eql :fail)) stream)
Method: print-result-status ((result test-error-result) (status (eql :crash)) stream)
Method: print-result-status ((result test-result) (status (eql :crash)) stream)
Method: print-result-status ((result test-result) (status (eql :pass)) stream)
Method: print-result-status ((result test-result) (status (eql :fail)) stream)
Generic Reader: test-result-error (object)
Package

unit-test.

Methods
Reader Method: test-result-error ((test-error-result test-error-result))

automatically generated reader method

Source

unit-test.lisp.

Target Slot

error.

Generic Reader: test-result-form (object)
Package

unit-test.

Methods
Reader Method: test-result-form ((test-result test-result))

automatically generated reader method

Source

unit-test.lisp.

Target Slot

form.

Generic Reader: test-result-real-value (object)
Package

unit-test.

Methods
Reader Method: test-result-real-value ((test-equal-result test-equal-result))

automatically generated reader method

Source

unit-test.lisp.

Target Slot

real-value.

Generic Reader: test-result-reason (object)
Package

unit-test.

Methods
Reader Method: test-result-reason ((test-result test-result))

automatically generated reader method

Source

unit-test.lisp.

Target Slot

reason.

Generic Reader: test-result-result (object)
Package

unit-test.

Methods
Reader Method: test-result-result ((test-condition-result test-condition-result))

automatically generated reader method

Source

unit-test.lisp.

Target Slot

result.

Generic Reader: test-result-status (object)
Package

unit-test.

Methods
Reader Method: test-result-status ((test-result test-result))

one of :pass, :fail, :crash

Source

unit-test.lisp.

Target Slot

status.

Generic Reader: test-result-value (object)
Package

unit-test.

Methods
Reader Method: test-result-value ((test-equal-result test-equal-result))

automatically generated reader method

Source

unit-test.lisp.

Target Slot

value.

Generic Reader: unit-test-body (object)
Package

unit-test.

Methods
Reader Method: unit-test-body ((unit-test unit-test))

automatically generated reader method

Source

unit-test.lisp.

Target Slot

body.

Generic Reader: unit-test-failed-form (object)
Package

unit-test.

Methods
Reader Method: unit-test-failed-form ((unit-test unit-test))

automatically generated reader method

Source

unit-test.lisp.

Target Slot

failed-form.

Generic Writer: (setf unit-test-failed-form) (object)
Package

unit-test.

Methods
Writer Method: (setf unit-test-failed-form) ((unit-test unit-test))

automatically generated writer method

Source

unit-test.lisp.

Target Slot

failed-form.

Generic Reader: unit-test-name (object)
Package

unit-test.

Methods
Reader Method: unit-test-name ((unit-test unit-test))

automatically generated reader method

Source

unit-test.lisp.

Target Slot

name.

Generic Reader: unit-test-unit (object)
Package

unit-test.

Methods
Reader Method: unit-test-unit ((unit-test unit-test))

Name of unit being tested. Used to group related tests.

Source

unit-test.lisp.

Target Slot

unit.


4.2.4 Classes

Class: test-assert-result
Package

unit-test.

Source

unit-test.lisp.

Direct superclasses

test-result.

Direct methods

print-result-form.

Class: unit-test

The base class for all unit tests. When tests are defined,
they will be stored in a global list of tests which can be run at any time with RUN-ALL-TESTS.

Package

unit-test.

Source

unit-test.lisp.

Direct methods
Direct slots
Slot: unit

Name of unit being tested. Used to group related tests.

Initargs

:unit

Readers

unit-test-unit.

Writers

This slot is read-only.

Slot: name
Initform

"unknown test"

Initargs

:name

Readers

unit-test-name.

Writers

This slot is read-only.

Slot: body
Initargs

:body

Readers

unit-test-body.

Writers

This slot is read-only.

Slot: failed-form
Initform

"unknown form"

Readers

unit-test-failed-form.

Writers

(setf unit-test-failed-form).


Appendix A Indexes


A.1 Concepts


A.2 Functions

Jump to:   (  
D   F   G   I   M   P   R   T   U  
Index Entry  Section

(
(setf unit-test-failed-form): Private generic functions
(setf unit-test-failed-form): Private generic functions

D
define-test-class: Public macros
deftest: Public macros
delete-all-tests: Private ordinary functions
delete-tests-for: Private ordinary functions

F
Function, delete-all-tests: Private ordinary functions
Function, delete-tests-for: Private ordinary functions
Function, get-test-by-name: Public ordinary functions
Function, run-all-tests: Public ordinary functions
Function, test-crashed-p: Private ordinary functions
Function, test-failed-p: Private ordinary functions
Function, test-fails: Private ordinary functions
Function, test-passed-p: Private ordinary functions
Function, test-passes: Private ordinary functions

G
Generic Function, (setf unit-test-failed-form): Private generic functions
Generic Function, print-result: Private generic functions
Generic Function, print-result-form: Private generic functions
Generic Function, print-result-status: Private generic functions
Generic Function, run-test: Public generic functions
Generic Function, test-result-error: Private generic functions
Generic Function, test-result-form: Private generic functions
Generic Function, test-result-real-value: Private generic functions
Generic Function, test-result-reason: Private generic functions
Generic Function, test-result-result: Private generic functions
Generic Function, test-result-status: Private generic functions
Generic Function, test-result-value: Private generic functions
Generic Function, unit-test-body: Private generic functions
Generic Function, unit-test-failed-form: Private generic functions
Generic Function, unit-test-name: Private generic functions
Generic Function, unit-test-unit: Private generic functions
get-test-by-name: Public ordinary functions

I
initialize-instance: Public standalone methods

M
Macro, define-test-class: Public macros
Macro, deftest: Public macros
Macro, test-assert: Public macros
Macro, test-condition: Public macros
Macro, test-equal: Public macros
Method, (setf unit-test-failed-form): Private generic functions
Method, initialize-instance: Public standalone methods
Method, print-object: Public standalone methods
Method, print-object: Public standalone methods
Method, print-result: Private generic functions
Method, print-result-form: Private generic functions
Method, print-result-form: Private generic functions
Method, print-result-form: Private generic functions
Method, print-result-form: Private generic functions
Method, print-result-form: Private generic functions
Method, print-result-status: Private generic functions
Method, print-result-status: Private generic functions
Method, print-result-status: Private generic functions
Method, print-result-status: Private generic functions
Method, print-result-status: Private generic functions
Method, print-result-status: Private generic functions
Method, run-test: Public generic functions
Method, test-result-error: Private generic functions
Method, test-result-form: Private generic functions
Method, test-result-real-value: Private generic functions
Method, test-result-reason: Private generic functions
Method, test-result-result: Private generic functions
Method, test-result-status: Private generic functions
Method, test-result-value: Private generic functions
Method, unit-test-body: Private generic functions
Method, unit-test-failed-form: Private generic functions
Method, unit-test-name: Private generic functions
Method, unit-test-unit: Private generic functions

P
print-object: Public standalone methods
print-object: Public standalone methods
print-result: Private generic functions
print-result: Private generic functions
print-result-form: Private generic functions
print-result-form: Private generic functions
print-result-form: Private generic functions
print-result-form: Private generic functions
print-result-form: Private generic functions
print-result-form: Private generic functions
print-result-status: Private generic functions
print-result-status: Private generic functions
print-result-status: Private generic functions
print-result-status: Private generic functions
print-result-status: Private generic functions
print-result-status: Private generic functions
print-result-status: Private generic functions

R
run-all-tests: Public ordinary functions
run-test: Public generic functions
run-test: Public generic functions

T
test-assert: Public macros
test-condition: Public macros
test-crashed-p: Private ordinary functions
test-equal: Public macros
test-failed-p: Private ordinary functions
test-fails: Private ordinary functions
test-passed-p: Private ordinary functions
test-passes: Private ordinary functions
test-result-error: Private generic functions
test-result-error: Private generic functions
test-result-form: Private generic functions
test-result-form: Private generic functions
test-result-real-value: Private generic functions
test-result-real-value: Private generic functions
test-result-reason: Private generic functions
test-result-reason: Private generic functions
test-result-result: Private generic functions
test-result-result: Private generic functions
test-result-status: Private generic functions
test-result-status: Private generic functions
test-result-value: Private generic functions
test-result-value: Private generic functions

U
unit-test-body: Private generic functions
unit-test-body: Private generic functions
unit-test-failed-form: Private generic functions
unit-test-failed-form: Private generic functions
unit-test-name: Private generic functions
unit-test-name: Private generic functions
unit-test-unit: Private generic functions
unit-test-unit: Private generic functions