From 79cb3bb3e53ed1b493d0ab47cba7465930a99a22 Mon Sep 17 00:00:00 2001 From: "Thomas M. Hermann" Date: Mon, 12 Dec 2011 08:55:01 -0600 Subject: [PATCH] Initial implementation of the internal testing functions. --- internal-tests.lisp | 26 ++++++++++++++++++++++---- lisp-unit.asd | 2 +- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/internal-tests.lisp b/internal-tests.lisp index 42f586d..c85ec5b 100644 --- a/internal-tests.lisp +++ b/internal-tests.lisp @@ -113,11 +113,11 @@ (INTERNAL-ASSERT :OUTPUT (QUOTE FORM) (LAMBDA NIL - (LET* ((#:G943 (MAKE-STRING-OUTPUT-STREAM)) + (LET* ((#:G1 (MAKE-STRING-OUTPUT-STREAM)) (*STANDARD-OUTPUT* (MAKE-BROADCAST-STREAM - *STANDARD-OUTPUT* #:G943))) + *STANDARD-OUTPUT* #:G1))) FORM - (GET-OUTPUT-STREAM-STRING #:G943))) + (GET-OUTPUT-STREAM-STRING #:G1))) (LAMBDA NIL OUTPUT) (LAMBDA NIL (LIST (QUOTE EXTRA1) EXTRA1 (QUOTE EXTRA2) EXTRA2)) @@ -133,9 +133,27 @@ (FUNCTION EQL)))) "The correct expansions for the fundamental assertions.") +(defun expansion-equal (form1 form2) + "Descend into the forms checking for equality." + (let ((item1 (first form1)) + (item2 (first form2))) + (cond + ((and (null item1) (null item2))) + ((and (listp item1) (listp item2)) + (and (expansion-equal item1 item2) + (expansion-equal (rest form1) (rest form2)))) + ((and (symbolp item1) (symbolp item2)) + (and (string= (symbol-name item1) (symbol-name item2)) + (expansion-equal (rest form1) (rest form2)))) + (t nil)))) + (defun test-fundamental-assertions () "Test each fundamental assertion and report the results." (loop for (assertion macro-form expansion) in *fundamental-assertion-expansions* + as *gensym-counter* = 1 collect - (list assertion (equal (macroexpand-1 macro-form) expansion)))) + (list + assertion + (expansion-equal + (macroexpand macro-form) expansion)))) diff --git a/lisp-unit.asd b/lisp-unit.asd index 6f003f1..9bd6d94 100644 --- a/lisp-unit.asd +++ b/lisp-unit.asd @@ -26,7 +26,7 @@ (defsystem :lisp-unit :description "Common Lisp library that supports unit testing." - :version "0.6.0" + :version "0.7.0" :author "Thomas M. Hermann " :license "MIT" :components -- 2.11.4.GIT