From 9e94e8f9f7112a23804b83011edef64f89784760 Mon Sep 17 00:00:00 2001 From: Phil Jackson Date: Fri, 8 Aug 2008 09:02:17 +0100 Subject: [PATCH] Stats now entering results buffer. --- etest-result-mode.el | 3 ++- etest.el | 58 +++++++++++++++++++++++++++------------------------- 2 files changed, 32 insertions(+), 29 deletions(-) diff --git a/etest-result-mode.el b/etest-result-mode.el index 8f2f9c5..2e98a77 100644 --- a/etest-result-mode.el +++ b/etest-result-mode.el @@ -153,12 +153,13 @@ current line." (when (cdr results) (etest-rm-pretty-print-results (cdr results) level)))) -(defun etest-rm-refresh-buffer (results) +(defun etest-rm-refresh-buffer (results stats) "Refresh the results buffer using the cached test results." (save-selected-window (switch-to-buffer-other-window (get-buffer-create "*etest*")) (setq buffer-read-only nil) (erase-buffer) + (insert (pp stats)) (etest-rm-pretty-print-results results 0) (etest-result-mode results) (goto-char (point-min)) diff --git a/etest.el b/etest.el index af18096..6057a75 100644 --- a/etest.el +++ b/etest.el @@ -185,40 +185,42 @@ results of the run." :timefinish 0)) (results (etest-run ',form stats))) (when (fboundp etest-results-function) - (funcall etest-results-function results)) + (funcall etest-results-function results stats)) results)) (defun etest-run (form &optional stats) "This function does all of the work where actually running the tests is concerned. Takes a valid etest form and will return a similarly shaped set of results. " - (mapcar - '(lambda (test) - (let ((name (car test))) - (cond - ((stringp name) - (cons name (etest-run (cdr test) stats))) - ((symbolp name) - (let ((cand (car (plist-get etest-candidates-plist name))) - (args (cdr test)) - (argcount (cadr (plist-get etest-candidates-plist name))) - (doc nil)) - (unless cand - (error "'%s' is not a valid name type" name)) - (if (< (length args) argcount) - (error "%s needs %d arguments" cand argcount) - (if (and (eq (length args) (1+ argcount)) - (stringp (car (last args)))) - (progn - (setq doc (car (last args))) - (setq args (delq doc args))) - (setq doc (prin1-to-string test)))) - (let ((results (apply cand args))) - (plist-put results :doc doc) - (when stats - (etest-stats-update results stats)) - results)))))) - form)) + (let ((all (mapcar + '(lambda (test) + (let ((name (car test))) + (cond + ((stringp name) + (cons name (etest-run (cdr test) stats))) + ((symbolp name) + (let ((cand (car (plist-get etest-candidates-plist name))) + (args (cdr test)) + (argcount (cadr (plist-get etest-candidates-plist name))) + (doc nil)) + (unless cand + (error "'%s' is not a valid name type" name)) + (if (< (length args) argcount) + (error "%s needs %d arguments" cand argcount) + (if (and (eq (length args) (1+ argcount)) + (stringp (car (last args)))) + (progn + (setq doc (car (last args))) + (setq args (delq doc args))) + (setq doc (prin1-to-string test)))) + (let ((results (apply cand args))) + (plist-put results :doc doc) + (when stats + (etest-stats-update results stats)) + results)))))) + form))) + (plist-put stats :timefinish (current-time)) + all)) (defun etest-stats-update (result stats) (let ((type (if (plist-get result :result) :pass :fail))) -- 2.11.4.GIT