diff options
Diffstat (limited to 'src/standard-hooks.lisp')
-rw-r--r-- | src/standard-hooks.lisp | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/src/standard-hooks.lisp b/src/standard-hooks.lisp new file mode 100644 index 0000000..fcf1367 --- /dev/null +++ b/src/standard-hooks.lisp @@ -0,0 +1,68 @@ +;;;; standard-hooks.lisp -- built-in hooks for standard def* macros + +(in-package :testiere) + +;;; DEFSTRUCT + +;; (defstruct moo +;; #+testiere +;; (:tests ...) +;; a b c) + +(register-hook + 'cl:defstruct + #'standard-extractor) + +;;; DEFCLASS + +;; (defclass fooar () +;; (slots...) +;; #+testiere +;; (:tests ...)) + +(defun defclass-restarts-expander (form) + (let ((name (second form))) + `((make-unbound + () + (setf (find-class ',name) nil))))) + +(register-hook + 'cl:defclass + #'standard-extractor + #'defclass-restarts-expander) + +;;; DEFMETHOD + +;; (defmethod okwhat ((x moo) (y bar) z) +;; "Here's a method" +;; #+testiere +;; (:tests ...) +;; (flah (moo-blah x) (barbar y))) + +(register-hook 'cl:defmethod #'standard-extractor) + +;;; DEFUN + +;; (defun add3 (x y z) +;; "Adds three thigns" +;; #+testiere +;; (:tests ...) +;; (+ x y z)) + +(defun defun-restarts-expander (form) + (let ((name (second form))) + `((make-unbound + () + (fmakunbound ',name))))) + +(register-hook 'cl:defun #'standard-extractor #'defun-restarts-expander) + +;;; DEFTYPE + +;; (deftype optional-number () +;; "Its a number, or not" +;; #+testiere +;; (:tests ...) +;; `(or number null)) + +(register-hook 'cl:deftype #'standard-extractor) |