From 2b3e66c31c6cf4f4b5a644b0217d46ca9966f3d6 Mon Sep 17 00:00:00 2001 From: Jim Newton Date: Tue, 14 Aug 2018 16:40:26 +0200 Subject: [PATCH 1/2] added defun-test macro --- lisp-unit.lisp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lisp-unit.lisp b/lisp-unit.lisp index 317a69f..3c05d47 100644 --- a/lisp-unit.lisp +++ b/lisp-unit.lisp @@ -75,6 +75,7 @@ :assert-error) ;; Functions for managing tests (:export :define-test + :defun-test :list-tests :test-code :test-documentation @@ -297,6 +298,14 @@ assertion.") ;; Return the name of the test ,qname)))) +(defmacro defun-test (name lambda-list &body body) + "Define a test and a function of the same name. +LAMBDA-LIST is a lambda list for the function, which may have &optional, &key, &aux arguments, but no manditory arguments." + `(progn (eval-when (:compile-toplevel :load-toplevel :execute) + (defun ,name ,lambda-list ,@body)) + (eval-when (:compile-toplevel :load-toplevel :execute) + (define-test ,name (,name))))) + ;;; Manage tests (defun list-tests (&optional (package *package*)) From fc87f44966bba839679b2263fc84e737fa2a3e6b Mon Sep 17 00:00:00 2001 From: Jim Newton Date: Thu, 16 Aug 2018 14:44:40 +0200 Subject: [PATCH 2/2] this commit fixes #53 --- lisp-unit.lisp | 1 + 1 file changed, 1 insertion(+) diff --git a/lisp-unit.lisp b/lisp-unit.lisp index 3c05d47..79c741b 100644 --- a/lisp-unit.lisp +++ b/lisp-unit.lisp @@ -298,6 +298,7 @@ assertion.") ;; Return the name of the test ,qname)))) +;; function requested in issue #53 (defmacro defun-test (name lambda-list &body body) "Define a test and a function of the same name. LAMBDA-LIST is a lambda list for the function, which may have &optional, &key, &aux arguments, but no manditory arguments."