diff tests/automated/test-harness.el @ 2056:ab71063baf27

[xemacs-hg @ 2004-05-03 15:08:41 by james] Add failing-case parameter to Assert and use it in lisp-tests.
author james
date Mon, 03 May 2004 15:08:51 +0000
parents db7c7e251153
children 3b1f8220a65e
line wrap: on
line diff
--- a/tests/automated/test-harness.el	Sun May 02 21:50:42 2004 +0000
+++ b/tests/automated/test-harness.el	Mon May 03 15:08:51 2004 +0000
@@ -210,18 +210,25 @@
 	       (Print-Skip ,description ,reason))
 	   ,@body))
 
-      (defmacro Assert (assertion)
+      (defmacro Assert (assertion &optional failing-case)
 	`(condition-case error-info
-	     (progn
-	       (assert ,assertion)
-	       (Print-Pass "%S" (quote ,assertion))
-	       (incf passes))
-	   (cl-assertion-failed
-	    (Print-Failure "Assertion failed: %S" (quote ,assertion))
-	    (incf assertion-failures))
-	   (t (Print-Failure "%S ==> error: %S" (quote ,assertion) error-info)
-	      (incf other-failures)
-	      )))
+	  (progn
+	    (assert ,assertion)
+	    (Print-Pass "%S" (quote ,assertion))
+	    (incf passes))
+	  (cl-assertion-failed
+	   (Print-Failure (if ,failing-case
+			      "Assertion failed: %S; failing case = %S"
+			    "Assertion failed: %S")
+			  (quote ,assertion) ,failing-case)
+	   (incf assertion-failures))
+	  (t (Print-Failure (if ,failing-case
+				"%S ==> error: %S; failing case =  %S"
+			      "%S ==> error: %S")
+			    (quote ,assertion) error-info ,failing-case)
+	     (incf other-failures)
+	     )))
+
 
       (defmacro Check-Error (expected-error &rest body)
 	(let ((quoted-body (if (= 1 (length body))