changeset 1751:5a9a66ba67ca

[xemacs-hg @ 2003-10-15 08:56:35 by stephent] test beautification <87vfqq6ftf.fsf@tleepslib.sk.tsukuba.ac.jp>
author stephent
date Wed, 15 Oct 2003 08:56:39 +0000
parents 7580e52a8218
children 84acc03a7080
files tests/ChangeLog tests/automated/test-harness.el
diffstat 2 files changed, 38 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/tests/ChangeLog	Wed Oct 15 03:09:03 2003 +0000
+++ b/tests/ChangeLog	Wed Oct 15 08:56:39 2003 +0000
@@ -1,3 +1,13 @@
+2003-10-15  Stephen J. Turnbull  <stephen@xemacs.org>
+
+	* automated/test-harness.el: Whitespace/readability tweaks.
+	(Copyright): Update.
+	(test-harness-file-summary-template): New constant.
+	(test-harness-null-summary-template): New constant.
+	(test-harness-from-buffer):
+	(batch-test-emacs):
+	Improve report formatting.
+
 2003-09-28  Adrian Aichner  <adrian@xemacs.org>
 
 	* automated/test-harness.el (batch-test-emacs): Emergency fix for
--- a/tests/automated/test-harness.el	Wed Oct 15 03:09:03 2003 +0000
+++ b/tests/automated/test-harness.el	Wed Oct 15 08:56:39 2003 +0000
@@ -1,6 +1,6 @@
 ;; test-harness.el --- Run Emacs Lisp test suites.
 
-;;; Copyright (C) 1998 Free Software Foundation, Inc.
+;;; Copyright (C) 1998, 2002, 2003 Free Software Foundation, Inc.
 ;;; Copyright (C) 2002 Ben Wing.
 
 ;; Author: Martin Buchholz
@@ -64,6 +64,18 @@
 (defvar emacs-lisp-file-regexp (purecopy "\\.el\\'")
   "*Regexp which matches Emacs Lisp source files.")
 
+(defconst test-harness-file-summary-template
+  (format "%%-%ds %%%dd of %%%dd tests successful (%%3d%%%%)."
+	  (length "byte-compiler-tests.el:") ; use the longest file name
+	  5
+	  5)
+  "Format for summary lines printed after each file is run.")
+
+(defconst test-harness-null-summary-template
+  (format "%%-%ds             No tests run."
+	  (length "byte-compiler-tests.el:")) ; use the longest file name
+  "Format for \"No tests\" lines printed after a file is run.")
+
 ;;;###autoload
 (defun test-emacs-test-file (filename)
   "Test a file of Lisp code named FILENAME.
@@ -118,7 +130,8 @@
 	  (setq body (cons (read buffer) body)))
       (end-of-file nil)
       (error
-       (princ (format "Unexpected error %S reading forms from buffer\n" error-info))))
+       (princ (format "Unexpected error %S reading forms from buffer\n"
+		      error-info))))
     `(lambda ()
        (defvar passes)
        (defvar assertion-failures)
@@ -337,9 +350,11 @@
 	     (basename (file-name-nondirectory filename))
 	     (summary-msg
 	      (if (> total 0)
-		  (format "%s: %d of %d tests successful (%d%%)."
-			  basename passes total (/ (* 100 passes) total))
-		(format "%s: No tests run" basename)))
+		  (format test-harness-file-summary-template
+			  (concat basename ":")
+			  passes total (/ (* 100 passes) total))
+		(format test-harness-null-summary-template
+			(concat basename ":"))))
 	     (reasons ""))
 	(maphash (lambda (key value)
 		   (setq reasons
@@ -366,7 +381,8 @@
       (fmakunbound 'Int-to-Marker)
       (and noninteractive
 	   (message "%s" (buffer-substring-no-properties
-			  nil nil "*Test-Log*"))))))
+			  nil nil "*Test-Log*")))
+      )))
 
 (defvar test-harness-results-point-max nil)
 (defmacro displaying-emacs-test-results (&rest body)
@@ -468,22 +484,20 @@
 	    (when (> tt testlen) (setq testlen tt)))
 	  (setq results (cdr results))))
       ;; create format and print
-      (let ((template
-	     (format "%%-%ds %%%dd of %%%dd tests successful (%%d%%%%)"
-		     (1+ namelen) succlen testlen))
-	    (results (reverse test-harness-file-results-alist)))
+      (let ((results (reverse test-harness-file-results-alist)))
 	(while results
 	  (let* ((head (car results))
-		 (fname (file-name-nondirectory (first head)))
+		 (basename (file-name-nondirectory (first head)))
 		 (nsucc (second head))
 		 (ntest (third head)))
 	    (if (> ntest 0)
-		(message template
-			 (concat fname ":")
+		(message test-harness-file-summary-template
+			 (concat basename ":")
 			 nsucc
 			 ntest
 			 (/ (* 100 nsucc) ntest))
-	      (message "%s: No tests run\n" fname))
+	      (message test-harness-null-summary-template
+		       (concat basename ":")))
 	    (setq results (cdr results))))))
     (message "\nDone")
     (kill-emacs (if error 1 0))))