projects
/
xlunit.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
r5451: *** empty log message ***
[xlunit.git]
/
assert.lisp
diff --git
a/assert.lisp
b/assert.lisp
index 269e797af812df4c46f63a38e30d922d46b10e9b..460bb4d07a92cc1246a0a9913a2ff92ffb9f21e9 100644
(file)
--- a/
assert.lisp
+++ b/
assert.lisp
@@
-2,7
+2,7
@@
;;;; *************************************************************************
;;;; FILE IDENTIFICATION
;;;;
;;;; *************************************************************************
;;;; FILE IDENTIFICATION
;;;;
-;;;; ID: $Id: assert.lisp,v 1.
2 2003/08/04 12:16:13
kevin Exp $
+;;;; ID: $Id: assert.lisp,v 1.
3 2003/08/04 12:28:46
kevin Exp $
;;;; Purpose: Assert functions for XLUnit
;;;;
;;;; *************************************************************************
;;;; Purpose: Assert functions for XLUnit
;;;;
;;;; *************************************************************************
@@
-17,25
+17,29
@@
(:documentation "Base class for all test failures."))
(:documentation "Base class for all test failures."))
-(defun failure
(
format-str &rest args)
+(defun failure
-msg (msg &optional
format-str &rest args)
"Signal a test failure and exit the test."
(signal 'test-failure-condition
"Signal a test failure and exit the test."
(signal 'test-failure-condition
+ :msg msg
:format-control format-str
:format-arguments args))
:format-control format-str
:format-arguments args))
+(defun failure (format-str &rest args)
+ "Signal a test failure and exit the test."
+ (apply #'failure-msg nil format-str args))
+
(defmacro test-assert (test &optional msg)
`(unless ,test
(defmacro test-assert (test &optional msg)
`(unless ,test
- (failure "Test assertion: ~s" ',test)))
+ (failure
-msg ,msg
"Test assertion: ~s" ',test)))
(defun assert-equal (v1 v2 &optional msg)
(unless (equal v1 v2)
(defun assert-equal (v1 v2 &optional msg)
(unless (equal v1 v2)
- (failure "Test equal: ~s ~s" v1 v2)))
-
-(defun assert-true (v &optional msg)
- (unless v
- (failure "Test true: ~s [~A]" v (if msg msg ""))))
+ (failure-msg msg "Test equal: ~S ~S" v1 v2)))
-(def
un assert-fals
e (v &optional msg)
-
(when
v
- (failure
"Test false ~A" (if msg msg "")
)))
+(def
macro assert-tru
e (v &optional msg)
+
`(unless ,
v
+ (failure
-msg msg "Not true: ~S" ',v
)))
+(defmacro assert-false (v &optional msg)
+ `(when ,v
+ (failure-msg msg "Not false: ~S" ',v)))