projects
/
xlunit.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
r5463: Auto commit for Debian build
[xlunit.git]
/
assert.lisp
diff --git
a/assert.lisp
b/assert.lisp
index fa2f100e92a216cf3bec1e0a4872b301e8e564e6..25db1e5e3ca93d8ab70392aeef29e8e4f4a6d237 100644
(file)
--- a/
assert.lisp
+++ b/
assert.lisp
@@
-2,7
+2,7
@@
;;;; *************************************************************************
;;;; FILE IDENTIFICATION
;;;;
;;;; *************************************************************************
;;;; FILE IDENTIFICATION
;;;;
-;;;; ID: $Id: assert.lisp,v 1.
4 2003/08/04 16:13:58
kevin Exp $
+;;;; ID: $Id: assert.lisp,v 1.
6 2003/08/05 22:56:25
kevin Exp $
;;;; Purpose: Assert functions for XLUnit
;;;;
;;;; *************************************************************************
;;;; Purpose: Assert functions for XLUnit
;;;;
;;;; *************************************************************************
@@
-11,33
+11,39
@@
(define-condition assertion-failed (simple-condition)
(define-condition assertion-failed (simple-condition)
- ((m
sg :initform nil :initarg :msg :accessor msg
))
+ ((m
essage :initform nil :initarg :message :accessor message
))
(:documentation "Base class for all test failures."))
(:documentation "Base class for all test failures."))
+(defmethod print-object ((obj assertion-failed) stream)
+ (print-unreadable-object (obj stream :type t :identity nil)
+ (apply #'format stream (simple-condition-format-control obj)
+ (simple-condition-format-arguments obj))))
-(defun failure-m
sg (msg
&optional format-str &rest args)
+(defun failure-m
essage (message
&optional format-str &rest args)
"Signal a test failure and exit the test."
"Signal a test failure and exit the test."
- (signal 'assertion-failed
- :msg msg
- :format-control format-str
+ (signal 'assertion-failed :message message :format-control format-str
:format-arguments args))
(defun failure (format-str &rest args)
"Signal a test failure and exit the test."
:format-arguments args))
(defun failure (format-str &rest args)
"Signal a test failure and exit the test."
- (apply #'failure-m
sg
nil format-str args))
+ (apply #'failure-m
essage
nil format-str args))
-(defun assert-equal (v1 v2 &optional m
sg
)
+(defun assert-equal (v1 v2 &optional m
essage
)
(unless (equal v1 v2)
(unless (equal v1 v2)
- (failure-m
sg msg "Tes
t equal: ~S ~S" v1 v2)))
+ (failure-m
essage message "Asser
t equal: ~S ~S" v1 v2)))
-(defun assert-eql (v1 v2 &optional m
sg
)
+(defun assert-eql (v1 v2 &optional m
essage
)
(unless (eql v1 v2)
(unless (eql v1 v2)
- (failure-m
sg msg "Tes
t eql: ~S ~S" v1 v2)))
+ (failure-m
essage message "Asser
t eql: ~S ~S" v1 v2)))
-(defmacro assert-true (v &optional msg)
+(defun assert-not-eql (v1 v2 &optional message)
+ (when (eql v1 v2)
+ (failure-message message "Assert not eql: ~S ~S" v1 v2)))
+
+(defmacro assert-true (v &optional message)
`(unless ,v
`(unless ,v
- (failure-m
sg msg "No
t true: ~S" ',v)))
+ (failure-m
essage ,message "Asser
t true: ~S" ',v)))
-(defmacro assert-false (v &optional m
sg
)
+(defmacro assert-false (v &optional m
essage
)
`(when ,v
`(when ,v
- (failure-m
sg msg "No
t false: ~S" ',v)))
+ (failure-m
essage ,message "Asser
t false: ~S" ',v)))