aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.org74
-rw-r--r--examples/examples.lisp4
-rw-r--r--src/testiere.lisp3
3 files changed, 41 insertions, 40 deletions
diff --git a/README.org b/README.org
index e070905..cfbe780 100644
--- a/README.org
+++ b/README.org
@@ -72,44 +72,42 @@ You can, of course, turn testiere off too:
Within the body of a ~(:tests ...)~ form are test expressions.
-| Expression | Description |
-|----------------------------------------------------+------------------------------------------------|
-| ~(:is form)~ | The test fails if ~form~ evaluates |
-| | to NIL. |
-|----------------------------------------------------+------------------------------------------------|
-| ~(pred form1 form2)~ | E.g ~(= (foo) 10)~ Provides more |
-| | informative error messages than ~:is~ |
-|----------------------------------------------------+------------------------------------------------|
-| ~(:funcall function arg1 ...)~ | Calls a function with some arguments. |
-| | If this function signals an error, |
-| | then the test fails. Useful when |
-| | running many or complex tests. |
-|----------------------------------------------------+------------------------------------------------|
-| ~(:fails form)~ | Evaluates ~form~ and expects it to |
-| | signal an error. If it does not |
-| | signal an error, the test fails. |
-|----------------------------------------------------+------------------------------------------------|
-| ~(:signals condition form)~ | Evaluates ~form~ and expects it to |
-| | signal a condition of type |
-| | ~condition~. If it does not, then |
-| | the test fails. |
-|----------------------------------------------------+------------------------------------------------|
-| ~(:let bindings test1 ...)~ | Runs test expressions in the context |
-| | of some bound variables. |
-|----------------------------------------------------+------------------------------------------------|
-| ~(:with-defuns ((name args body) ...) tests ... )~ | Mimics ~labels~ syntax. Used for |
-| | stubbing / mocking functions will which |
-| | have temporary definitions for the |
-| | duration of the ~:with-defuns~ form. |
-|----------------------------------------------------+------------------------------------------------|
-| ~(:with-generic name methods tests ... )~ | Temporarily redefine the an entire generic |
-| | function for the duration of the enclosed |
-| | ~tests~. ~methods~ is a list of forms, each of |
-| | is essentially anything that normally follows |
-| | ~(defmethod name ...)~. |
-| | E.g. ~((x string) (string-upcase x))~ or |
-| | ~(:after (x string) (print "after"))~ |
-
+| Expression | Description |
+|----------------------------------------------------+------------------------------------------------------|
+| ~(:is form)~ | The test fails if ~form~ evaluates to NIL. |
+|----------------------------------------------------+------------------------------------------------------|
+| ~(pred form1 form2)~ | E.g ~(= (foo) 10)~ Provides more informative |
+| | error messages than ~:is~ |
+|----------------------------------------------------+------------------------------------------------------|
+| ~(:funcall function arg1 ...)~ | Calls a function with some arguments. If this |
+| | function signals an error, then the test fails. |
+| | Useful when running several complext tests. |
+|----------------------------------------------------+------------------------------------------------------|
+| ~(:fails form)~ | Evaluates ~form~ and expects it to singal an error. |
+| | If it does not signal an error, then the test fails. |
+|----------------------------------------------------+------------------------------------------------------|
+| ~(:signals condition form)~ | Evaluates ~form~ and expects it to signal a |
+| | condition of type ~condition~. If it does not, then |
+| | the test fails. |
+|----------------------------------------------------+------------------------------------------------------|
+| ~(:let bindings test1 ...)~ | Runs test expressions in the context of some bound |
+| | variables. |
+|----------------------------------------------------+------------------------------------------------------|
+| ~(:with-defuns ((name args body) ...) tests ... )~ | Mimics ~labels~ syntax. Used for stubbing / mocking |
+| | functions will which have temporary definitions for |
+| | the duration of the ~:with-defuns~ form. |
+|----------------------------------------------------+------------------------------------------------------|
+| ~(:with-generic name methods tests ... )~ | Temporarily redefine the an entire generic |
+| | function for the duration of the enclosed |
+| | ~tests~. ~methods~ is a list of forms, each of |
+| | is essentially anything that normally follows |
+| | ~(defmethod name ...)~. |
+| | E.g. ~((x string) (string-upcase x))~ or |
+| | ~(:after (x string) (print "after"))~ |
+|----------------------------------------------------+------------------------------------------------------|
+| ~(:do form)~ | Evaluate ~form~ for its side effects. Useful |
+| | within a ~:let~, ~:with-defuns~, or ~:with-generic~ |
+| | |
** Examples
#+begin_src lisp
diff --git a/examples/examples.lisp b/examples/examples.lisp
index d437826..99ad26e 100644
--- a/examples/examples.lisp
+++ b/examples/examples.lisp
@@ -46,9 +46,9 @@ tests that aren't part of the package you're testing."
#+testiere
(:tests
(:let ((*count* 5))
- (:funcall #'increment-count)
+ (:do (increment-count))
(= *count* 6)
- (:funcall #'increment-count 4)
+ (:do (increment-count 4))
(= *count* 10))
(:let ((*count* -10))
(= (increment-count) -9)))
diff --git a/src/testiere.lisp b/src/testiere.lisp
index df516e0..9c9e4bb 100644
--- a/src/testiere.lisp
+++ b/src/testiere.lisp
@@ -84,6 +84,9 @@ restarts to try when tests fail."
((list* :let (list* bindings) body)
`(let ,bindings ,@(expand-test-forms body)))
+ ((list :do form)
+ form)
+
((list :is form)
`(assert ,form () "~s failed" ',form))