Common Lisp Package: EOS

README:

FUNCTION

Public

!

Rerun the most recently run test and explain the results.

!!

Rerun the second most recently run test and explain the results.

!!!

Rerun the third most recently run test and explain the results.

DEBUG! (&OPTIONAL (TEST-SPEC *SUITE*))

Calls (run! test-spec) but enters the debugger if any kind of error happens.

EXPLAIN! (RESULT-LIST)

Explain the results of RESULT-LIST using a detailed-text-explainer with output going to *test-dribble*

MAKE-SUITE (NAME &KEY DESCRIPTION IN)

Create a new test suite object. Overides any existing suite named NAME.

RESULTS-STATUS (RESULT-LIST)

Given a list of test results (generated while running a test) return true if all of the results are of type TEST-PASSED, faile otherwise.

RUN (TEST-SPEC)

Run the test specified by TEST-SPEC. TEST-SPEC can be either a symbol naming a test or test suite, or a testable-object object. This function changes the operations performed by the !, !! and !!! functions.

RUN! (&OPTIONAL (TEST-SPEC *SUITE*))

Equivalent to (explain (run TEST-SPEC)).

Undocumented

GET-TEST (KEY &OPTIONAL DEFAULT)

SETFGET-TEST (VALUE KEY)

REM-TEST (KEY)

TEST-NAMES

Private

ADD-RESULT (RESULT-TYPE &REST MAKE-INSTANCE-ARGS)

Create a TEST-RESULT object of type RESULT-TYPE passing it the initialize args MAKE-INSTANCE-ARGS and adds the resulting object to the list of test results.

RETURN-RESULT-LIST (TEST-LAMBDA)

Run the test function TEST-LAMBDA and return a list of all test results generated, does not modify the special environment variable RESULT-LIST.

Undocumented

BINDING (X BINDS)

ENSURE-LIST (X)

FIND-VARS (SPEC ACC)

IMPORT-TESTING-SYMBOLS (PACKAGE-DESIGNATOR)

LIST-MATCH (X Y &OPTIONAL BINDS)

PARTITION-RESULTS (RESULTS-LIST)

VARSYMP (X)

MACRO

Public

DEF-SUITE (NAME &KEY DESCRIPTION IN)

Define a new test-suite named NAME. IN (a symbol), if provided, causes this suite te be nested in the suite named by IN. NB: This macro is built on top of make-suite, as such it, like make-suite, will overrwrite any existing suite named NAME.

FAIL (&REST MESSAGE-ARGS)

Simply generate a FAIL.

FINISHES (&BODY BODY)

Generates a pass if BODY executes to normal completion. In other words if body does signal, return-from or throw this test fails.

IN-SUITE (SUITE-NAME)

Set the *suite* special variable so that all tests defined after the execution of this form are, unless specified otherwise, in the test-suite named SUITE-NAME. See also: DEF-SUITE *SUITE*

IN-SUITE* (SUITE-NAME &KEY IN)

Just like in-suite, but silently creates missing suites.

IS (TEST &REST REASON-ARGS)

The DWIM checking operator. If TEST returns a true value a test-passed result is generated, otherwise a test-failure result is generated. The reason, unless REASON-ARGS is provided, is generated based on the form of TEST: (predicate expected actual) - Means that we want to check whether, according to PREDICATE, the ACTUAL value is in fact what we EXPECTED. (predicate value) - Means that we want to ensure that VALUE satisfies PREDICATE. Wrapping the TEST form in a NOT simply preducse a negated reason string.

IS-FALSE (CONDITION &REST REASON-ARGS)

Generates a pass if CONDITION returns false, generates a failure otherwise. Like IS-TRUE, and unlike IS, IS-FALSE does not inspect CONDITION to determine what reason to give it case of test failure

IS-TRUE (CONDITION &REST REASON-ARGS)

Like IS this check generates a pass if CONDITION returns true and a failure if CONDITION returns false. Unlike IS this check does not inspect CONDITION to determine how to report the failure.

PASS (&REST MESSAGE-ARGS)

Simply generate a PASS.

SIGNALS (CONDITION-SPEC &BODY BODY)

Generates a pass if BODY signals a condition of type CONDITION. BODY is evaluated in a block named NIL, CONDITION is not evaluated.

SKIP (&REST REASON)

Generates a TEST-SKIPPED result.

TEST (NAME &BODY BODY)

Create a test named NAME. If NAME is a list it must be of the form: (name &key depends-on suite fixture compile-at) NAME is the symbol which names the test. DEPENDS-ON is a list of the form: (AND . test-names) - This test is run only if all of the tests in TEST-NAMES have passed, otherwise a single test-skipped result is generated. (OR . test-names) - If any of TEST-NAMES has passed this test is run, otherwise a test-skipped result is generated. (NOT test-name) - This is test is run only if TEST-NAME failed. AND, OR and NOT can be combined to produce complex dependencies. If DEPENDS-ON is a symbol it is interpreted as `(AND ,depends-on), this is accomadate the common case of one test depending on another. FIXTURE specifies a fixtrue to wrap the body in.

Private

WITH-GENSYMS ((&REST SYMS) &BODY BODY)

This is a simple WITH-GENSYMS, similar to the one presented in PCL.

Undocumented

%IN-SUITE (SUITE-NAME &KEY (FAIL-ON-ERROR T) IN)

ACOND2 (&REST CLAUSES)

AIF (TEST TRUE &OPTIONAL FALSE)

BIND-RUN-STATE (REQUESTED-VARS &BODY BODY)

COLLECT (NAMES &BODY BODY &AUX MACROS BINDS)

DEF-SUITE* (NAME &REST DEF-SUITE-ARGS)

FUN (&BODY BODY)

LIST-MATCH-CASE (TARGET &BODY CLAUSES)

PROCESS-FAILURE (&REST ARGS)

WITH-*TEST-DRIBBLE* (STREAM &BODY BODY)

WITH-RUN-STATE (REQUESTED-VARS &BODY BODY)

GENERIC-FUNCTION

Public

Undocumented

EXPLAIN (EXPLAINER RESULTS &OPTIONAL STREAM RECURSIVE-DEPTH)

Private

%RUN (TEST-SPEC)

Internal method for running a test. Does not update the status of the tests nor the special vairables !, !!, or !!!

RUN-RESOLVING-DEPENDENCIES (TEST)

Given a dependency spec determine if the spec is satisfied or not, this will generally involve running other tests. If the dependency spec can be satisfied the test is also run.

Undocumented

RESOLVE-DEPENDENCIES (DEPENDS-ON)

RUN-TEST-LAMBDA (TEST)

TEST-FAILURE-P (OBJECT)

TEST-PASSED-P (OBJECT)

TEST-SKIPPED-P (OBJECT)

SLOT-ACCESSOR

Private

DEPENDS-ON (OBJECT)

The list of AND, OR, NOT forms specifying when to run this test.

SETFDEPENDS-ON (NEW-VALUE OBJECT)

The list of AND, OR, NOT forms specifying when to run this test.

DESCRIPTION (OBJECT)

The textual description of this test object.

SETFDESCRIPTION (NEW-VALUE OBJECT)

The textual description of this test object.

NAME (OBJECT)

A symbol naming this test object.

SETFNAME (NEW-VALUE OBJECT)

A symbol naming this test object.

RUNTIME-PACKAGE (OBJECT)

By default it stores *package* from the time this test was defined (macroexpanded).

SETFRUNTIME-PACKAGE (NEW-VALUE OBJECT)

By default it stores *package* from the time this test was defined (macroexpanded).

STATUS (OBJECT)

A symbol specifying the current status of this test. Either: T - this test (and all its dependencies, have passed. NIL - this test failed (either it failed or its dependecies weren't met. :circular this test has a circular dependency and was skipped. Or :depends-not-satisfied or :resolving

SETFSTATUS (NEW-VALUE OBJECT)

A symbol specifying the current status of this test. Either: T - this test (and all its dependencies, have passed. NIL - this test failed (either it failed or its dependecies weren't met. :circular this test has a circular dependency and was skipped. Or :depends-not-satisfied or :resolving

TEST-LAMBDA (OBJECT)

The function to run.

SETFTEST-LAMBDA (NEW-VALUE OBJECT)

The function to run.

TESTS (OBJECT)

The hash table mapping names to test objects in this suite. The values in this hash table can be either test-cases or other test-suites.

SETFTESTS (NEW-VALUE OBJECT)

The hash table mapping names to test objects in this suite. The values in this hash table can be either test-cases or other test-suites.

Undocumented

ACTUAL-CONDITION (OBJECT)

SETFACTUAL-CONDITION (NEW-VALUE OBJECT)

REASON (OBJECT)

SETFREASON (NEW-VALUE OBJECT)

TEST-CASE (OBJECT)

SETFTEST-CASE (NEW-VALUE OBJECT)

TEST-EXPR (OBJECT)

SETFTEST-EXPR (NEW-VALUE OBJECT)

VARIABLE

Public

*DEBUG-ON-ERROR*

T if we should drop into a debugger on error, NIL otherwise.

*DEBUG-ON-FAILURE*

T if we should drop into a debugger on a failing check, NIL otherwise.

*RUN-TEST-WHEN-DEFINED*

When non-NIL tests are run as soon as they are defined.

*VERBOSE-FAILURES*

T if we should print the expression failing, NIL otherwise.

Undocumented

*TEST-DRIBBLE*

Private

*RUN-QUEUE*

List of test waiting to be run.

*SUITE*

The current test suite object

*TEST*

Table containing all test and test suite objects.

Undocumented

*!!!*

*!!*

*!*

*INITIAL-!*

CLASS

Private

TEST-CASE (OBJECT)

A test case is a single, named, collection of checks. A test case is the smallest organizational element which can be run individually. Every test case has a name, which is a symbol, a description and a test lambda. The test lambda is a regular funcall'able function which should use the various checking macros to collect results. Every test case is part of a suite, when a suite is not explicitly specified (either via the :SUITE parameter to the TEST macro or the global variable *SUITE*) the test is inserted into the global suite named NIL. Sometimes we want to run a certain test only if another test has passed. FiveAM allows us to specify the ways in which one test is dependent on another. - AND Run this test only if all the named tests passed. - OR Run this test if at least one of the named tests passed. - NOT Run this test only if another test has failed. FiveAM considers a test to have passed if all the checks executed were successful, otherwise we consider the test a failure. When a test is not run due to it's dependencies having failed a test-skipped result is added to the results.

TEST-FAILURE

Class for unsuccessful checks.

TEST-PASSED

Class for successful checks.

TEST-RESULT

All checking macros will generate an object of type TEST-RESULT.

TEST-SKIPPED

A test which was not run. Usually this is due to unsatisfied dependencies, but users can decide to skip test when appropiate.

TEST-SUITE

A test suite is a collection of tests or test suites. Test suites serve to organize tests into groups so that the developer can chose to run some tests and not just one or all. Like tests test suites have a name and a description. Test suites, like tests, can be part of other test suites, this allows the developer to create a hierarchy of tests where sub trees can be singularly run. Running a test suite has the effect of running every test (or suite) in the suite.

UNEXPECTED-TEST-FAILURE

Represents the result of a test which neither passed nor failed, but signaled an error we couldn't deal with. Note: This is very different than a SIGNALS check which instead creates a TEST-PASSED or TEST-FAILURE object.

Undocumented

DETAILED-TEXT-EXPLAINER

EXPLAINER

SIMPLE-TEXT-EXPLAINER

TESTABLE-OBJECT

TEXT-EXPLAINER

CONDITION

Private

CHECK-FAILURE

Signaled when a check fails.

CIRCULAR-DEPENDENCY

Condition signaled when a circular dependency between test-cases has been detected.