From 4025722943ae814c88da1fa8fe5778cffecce4ad Mon Sep 17 00:00:00 2001 From: colin Date: Sat, 9 Sep 2023 11:09:10 -0700 Subject: Testiere2 Add examples changed some internal names; improved some error messages Added more examples renaming exports Added New Readme --- src/standard-hooks.lisp | 68 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 src/standard-hooks.lisp (limited to 'src/standard-hooks.lisp') 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) -- cgit v1.2.3