Skip to content
This repository has been archived by the owner on Aug 13, 2020. It is now read-only.

Commit

Permalink
No more call to arnesi:def-special-environment
Browse files Browse the repository at this point in the history
  • Loading branch information
adlai committed Sep 1, 2009
1 parent 5d0ff8b commit 9371367
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions src/check.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,22 @@
(declare (special *test-dribble*))
,@body))

;;; This function is taken from Arnesi, to help with the following macros
(eval-when (:compile-toplevel :load-toplevel :execute)
(def-special-environment run-state ()
result-list
current-test))
(defun check-required (name vars required)
(dolist (var required)
(assert (member var vars) (var)
"Unrecognized symbol ~S in ~S." var name))))

(symbol-macrolet ((name 'run-state) (vars '(result-list current-test)))
(defmacro bind-run-state (requested-vars &body body)
(check-required name vars (mapcar 'car requested-vars))
`(let ,requested-vars
(declare (special ,@(mapcar 'car requested-vars)))
,@body))
(defmacro with-run-state (requested-vars &body body)
(check-required name vars requested-vars)
`(locally (declare (special ,@requested-vars)) ,@body)))

(defclass test-result ()
((reason :accessor reason :initarg :reason :initform "no reason given")
Expand Down

0 comments on commit 9371367

Please sign in to comment.