The assertion-error Reference Manual

Table of Contents

Next: , Previous: , Up: (dir)   [Contents][Index]

The assertion-error Reference Manual

This is the assertion-error Reference Manual, version 0.0.0, generated automatically by Declt version 2.4 patchlevel 1 "Will Decker" on Fri May 24 07:47:41 2019 GMT+0.


Next: , Previous: , Up: Top   [Contents][Index]

1 Introduction

assertion-error

Error pattern for assertion libraries in Common Lisp.

Getting Started in assertion-error

Installation

The assertion-error system has only one dependency, which is the dissect system, I do not know if it will depend forever on this library, but for now it is necessary, since Common Lisp does not have a standard to get the stack trace.

1 - Download the dissect system

By quicklisp:

http://quickdocs.org/dissect/

or directly from github:

git clone https://github.com/Shinmera/dissect.git

2 - Download assertion-error system

By quicklisp:

IN PROGRESS...

or directly from github:

git clone https://github.com/noloop/assertion-error.git

3 - Install assertion-error

By quicklisp:

IN PROGRESS...

or directly from asdf:

(asdf:load-system :assertion-error)

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 assertion with assertion-error

Use assertion-error when constructing your assertion library:


(defun is-t? (actual)
  (assertion (equal t actual) actual t 'equal))

(defun is-nil? (actual)
  (assertion (equal nil actual) actual nil 'equal))

(defun assertion (result actual expected operator)
  (unless result
    (error 'assertion-error
           :assertion-error-message (concatenate 'string (string actual) " " (string operator) " " (string expected))
           :assertion-error-result result
           :assertion-error-actual actual
           :assertion-error-expected expected
           :assertion-error-stack (get-stack-trace))))

Catch assertion-error

Use assertion-error to build your test runner, where it can capture the errors of your assertion library which one also uses assertion-error:

(handler-case (assert:is-t? nil)
   (assertion-error:assertion-error (c)
         (format t "~a" (assertion-error:assertion-error-actual c))))

API

All generic functions below returns some information from the assertion-error condition. They have a required argument that is the assertion-error condition. Check out the catch assertion-error example to understand how to use them.

condition assertion-error

function (get-stack-trace)

condition :reader (assertion-error-message c)

condition :reader (assertion-error-result c)

condition :reader (assertion-error-actual c)

condition :reader (assertion-error-expected c)

condition :reader (assertion-error-stack c)


Next: , Previous: , Up: Top   [Contents][Index]

2 Systems

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


Previous: , Up: Systems   [Contents][Index]

2.1 assertion-error

Maintainer

noloop <noloop@zoho.com>

Author

noloop <noloop@zoho.com>

Home Page

https://github.com/noloop/assertion-error

Source Control

(:git "git@github.com:noloop/assertion-error.git")

Bug Tracker

https://github.com/noloop/assertion-error/issues

License

GNU General Public License v3.0

Description

Error pattern for assertion libraries in Common Lisp.

Long Description

# assertion-error

### _Error pattern for assertion libraries in Common Lisp._

## Getting Started in assertion-error

### Installation

The assertion-error system has only one dependency, which is the [dissect](https://github.com/Shinmera/dissect) system, I do not know if it will depend forever on this library, but for now it is necessary, since Common Lisp does not have a standard to get the stack trace.

**1 - Download the dissect system**

By quicklisp:

“‘
http://quickdocs.org/dissect/
“‘
or directly from github:

“‘
git clone https://github.com/Shinmera/dissect.git
“‘

**2 - Download assertion-error system**

By quicklisp:

“‘
IN PROGRESS...
“‘

or directly from github:

“‘
git clone https://github.com/noloop/assertion-error.git
“‘

**3 - Install assertion-error**

By quicklisp:

“‘
IN PROGRESS...
“‘

or directly from asdf:

“‘lisp
(asdf:load-system :assertion-error)
“‘

_**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 assertion with assertion-error

Use assertion-error when constructing your assertion library:

“‘lisp

(defun is-t? (actual)
(assertion (equal t actual) actual t ’equal))

(defun is-nil? (actual)
(assertion (equal nil actual) actual nil ’equal))

(defun assertion (result actual expected operator)
(unless result
(error ’assertion-error
:assertion-error-message (concatenate ’string (string actual) " " (string operator) " " (string expected))
:assertion-error-result result
:assertion-error-actual actual
:assertion-error-expected expected
:assertion-error-stack (get-stack-trace))))

“‘

### Catch assertion-error

Use assertion-error to build your test runner, where it can capture the errors of your assertion library which one also uses assertion-error:

“‘lisp
(handler-case (assert:is-t? nil)
(assertion-error:assertion-error (c)
(format t "~a" (assertion-error:assertion-error-actual c))))
“‘

## API

All generic functions below returns some information from the assertion-error condition. They have a required argument that is the assertion-error condition. Check out the [catch assertion-error example](https://github.com/noloop/assertion-error#catch-assertion-error) to understand how to use them.

condition **assertion-error**

function **(get-stack-trace)**

condition :reader **(assertion-error-message c)**

condition :reader **(assertion-error-result c)**

condition :reader **(assertion-error-actual c)**

condition :reader **(assertion-error-expected c)**

condition :reader **(assertion-error-stack c)**

Version

0.0.0

Dependency

dissect

Source

assertion-error.asd (file)

Component

src (module)


Next: , Previous: , Up: Top   [Contents][Index]

3 Modules

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


Previous: , Up: Modules   [Contents][Index]

3.1 assertion-error/src

Parent

assertion-error (system)

Location

src/

Components

Next: , Previous: , Up: Top   [Contents][Index]

4 Files

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


Previous: , Up: Files   [Contents][Index]

4.1 Lisp


Next: , Previous: , Up: Lisp files   [Contents][Index]

4.1.1 assertion-error.asd

Location

assertion-error.asd

Systems

assertion-error (system)


Next: , Previous: , Up: Lisp files   [Contents][Index]

4.1.2 assertion-error/src/package.lisp

Parent

src (module)

Location

src/package.lisp

Packages

noloop.assertion-error


Previous: , Up: Lisp files   [Contents][Index]

4.1.3 assertion-error/src/assertion-error.lisp

Dependency

package.lisp (file)

Parent

src (module)

Location

src/assertion-error.lisp

Exported Definitions

Next: , Previous: , Up: Top   [Contents][Index]

5 Packages

Packages are listed by definition order.


Previous: , Up: Packages   [Contents][Index]

5.1 noloop.assertion-error

Source

package.lisp (file)

Nickname

assertion-error

Use List

common-lisp

Exported Definitions

Next: , Previous: , Up: Top   [Contents][Index]

6 Definitions

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


Previous: , Up: Definitions   [Contents][Index]

6.1 Exported definitions


Next: , Previous: , Up: Exported definitions   [Contents][Index]

6.1.1 Functions

Function: get-stack-trace ()
Package

noloop.assertion-error

Source

assertion-error.lisp (file)


Next: , Previous: , Up: Exported definitions   [Contents][Index]

6.1.2 Generic functions

Generic Function: assertion-error-actual CONDITION
Package

noloop.assertion-error

Methods
Method: assertion-error-actual (CONDITION assertion-error)
Source

assertion-error.lisp (file)

Generic Function: assertion-error-expected CONDITION
Package

noloop.assertion-error

Methods
Method: assertion-error-expected (CONDITION assertion-error)
Source

assertion-error.lisp (file)

Generic Function: assertion-error-message CONDITION
Package

noloop.assertion-error

Methods
Method: assertion-error-message (CONDITION assertion-error)
Source

assertion-error.lisp (file)

Generic Function: assertion-error-result CONDITION
Package

noloop.assertion-error

Methods
Method: assertion-error-result (CONDITION assertion-error)
Source

assertion-error.lisp (file)

Generic Function: assertion-error-stack CONDITION
Package

noloop.assertion-error

Methods
Method: assertion-error-stack (CONDITION assertion-error)
Source

assertion-error.lisp (file)


Previous: , Up: Exported definitions   [Contents][Index]

6.1.3 Conditions

Condition: assertion-error ()
Package

noloop.assertion-error

Source

assertion-error.lisp (file)

Direct superclasses

error (condition)

Direct methods
Direct slots
Slot: assertion-error-message
Initargs

:assertion-error-message

Readers

assertion-error-message (generic function)

Slot: assertion-error-result
Initargs

:assertion-error-result

Readers

assertion-error-result (generic function)

Slot: assertion-error-actual
Initargs

:assertion-error-actual

Readers

assertion-error-actual (generic function)

Slot: assertion-error-expected
Initargs

:assertion-error-expected

Readers

assertion-error-expected (generic function)

Slot: assertion-error-stack
Initargs

:assertion-error-stack

Readers

assertion-error-stack (generic function)


Previous: , Up: Top   [Contents][Index]

Appendix A Indexes


Next: , Previous: , Up: Indexes   [Contents][Index]

A.1 Concepts

Jump to:   A   F   L   M  
Index Entry  Section

A
assertion-error.asd: The assertion-error<dot>asd file
assertion-error/src: The assertion-error/src module
assertion-error/src/assertion-error.lisp: The assertion-error/src/assertion-error<dot>lisp file
assertion-error/src/package.lisp: The assertion-error/src/package<dot>lisp file

F
File, Lisp, assertion-error.asd: The assertion-error<dot>asd file
File, Lisp, assertion-error/src/assertion-error.lisp: The assertion-error/src/assertion-error<dot>lisp file
File, Lisp, assertion-error/src/package.lisp: The assertion-error/src/package<dot>lisp file

L
Lisp File, assertion-error.asd: The assertion-error<dot>asd file
Lisp File, assertion-error/src/assertion-error.lisp: The assertion-error/src/assertion-error<dot>lisp file
Lisp File, assertion-error/src/package.lisp: The assertion-error/src/package<dot>lisp file

M
Module, assertion-error/src: The assertion-error/src module

Jump to:   A   F   L   M  

Next: , Previous: , Up: Indexes   [Contents][Index]

A.2 Functions

Jump to:   A   F   G   M  
Index Entry  Section

A
assertion-error-actual: Exported generic functions
assertion-error-actual: Exported generic functions
assertion-error-expected: Exported generic functions
assertion-error-expected: Exported generic functions
assertion-error-message: Exported generic functions
assertion-error-message: Exported generic functions
assertion-error-result: Exported generic functions
assertion-error-result: Exported generic functions
assertion-error-stack: Exported generic functions
assertion-error-stack: Exported generic functions

F
Function, get-stack-trace: Exported functions

G
Generic Function, assertion-error-actual: Exported generic functions
Generic Function, assertion-error-expected: Exported generic functions
Generic Function, assertion-error-message: Exported generic functions
Generic Function, assertion-error-result: Exported generic functions
Generic Function, assertion-error-stack: Exported generic functions
get-stack-trace: Exported functions

M
Method, assertion-error-actual: Exported generic functions
Method, assertion-error-expected: Exported generic functions
Method, assertion-error-message: Exported generic functions
Method, assertion-error-result: Exported generic functions
Method, assertion-error-stack: Exported generic functions

Jump to:   A   F   G   M  

Next: , Previous: , Up: Indexes   [Contents][Index]

A.3 Variables

Jump to:   A   S  
Index Entry  Section

A
assertion-error-actual: Exported conditions
assertion-error-expected: Exported conditions
assertion-error-message: Exported conditions
assertion-error-result: Exported conditions
assertion-error-stack: Exported conditions

S
Slot, assertion-error-actual: Exported conditions
Slot, assertion-error-expected: Exported conditions
Slot, assertion-error-message: Exported conditions
Slot, assertion-error-result: Exported conditions
Slot, assertion-error-stack: Exported conditions

Jump to:   A   S  

Previous: , Up: Indexes   [Contents][Index]

A.4 Data types

Jump to:   A   C   N   P   S  
Index Entry  Section

A
assertion-error: The assertion-error system
assertion-error: Exported conditions

C
Condition, assertion-error: Exported conditions

N
noloop.assertion-error: The noloop<dot>assertion-error package

P
Package, noloop.assertion-error: The noloop<dot>assertion-error package

S
System, assertion-error: The assertion-error system

Jump to:   A   C   N   P   S