From: Ryan Davis Date: Tue, 5 Feb 2013 14:56:42 +0000 (-0500) Subject: print out test duration, in seconds X-Git-Tag: 0.9.4~1^2~1^2 X-Git-Url: https://repo.or.cz/w/lisp-unit.git/commitdiff_plain/03c621d353588c817e73386ffa633a96d8925a57 print out test duration, in seconds --- diff --git a/extensions/test-anything-protocol.lisp b/extensions/test-anything-protocol.lisp index d9acbca..09653f8 100644 --- a/extensions/test-anything-protocol.lisp +++ b/extensions/test-anything-protocol.lisp @@ -34,15 +34,21 @@ (export '(write-tap write-tap-to-file)) +(defun run-time-s (test-result) + "calculate the run-time of the test in seconds" + (/ (run-time test-result) + internal-time-units-per-second)) + (defun %write-tap-test-result (name test-result i stream) "Output a single test, taking care to ensure the indentation level is the same before and after invocation." (pprint-logical-block (stream nil) (format stream - "~:[ok~;not ok~] ~d ~s" + "~:[ok~;not ok~] ~d ~s (~,2f s)" (or (fail test-result) (exerr test-result)) - i name) + i name + (run-time-s test-result)) (when (or (fail test-result) (exerr test-result)) ;; indent only takes affect after a newline, so force one