From: ueno Date: Sun, 28 Nov 2004 06:05:15 +0000 (+0000) Subject: * test/lunit.el: Require 'pp. X-Git-Tag: riece-1_0_6~13 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=02cddaf70f1f5d4d83111601301c4355fb6d773f;p=elisp%2Friece.git * test/lunit.el: Require 'pp. (lunit-escape-quote): Rename from lunit-test-reporter-format-sexp. (lunit-report): Add "emacs-version" property. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 5db11c4..c0cdfa8 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,11 @@ 2004-11-28 Daiki Ueno + * test/lunit.el: Require 'pp. + (lunit-escape-quote): Rename from lunit-test-reporter-format-sexp. + (lunit-report): Add "emacs-version" property. + +2004-11-28 Daiki Ueno + * COMPILE (riece-test): Use lunit-report instead of lunit. * test/lunit.el: Report test result as XML. diff --git a/lisp/test/lunit.el b/lisp/test/lunit.el index a702f65..de29e87 100644 --- a/lisp/test/lunit.el +++ b/lisp/test/lunit.el @@ -50,6 +50,8 @@ (eval-when-compile (require 'cl)) +(require 'pp) + ;;; @ test ;;; @@ -307,16 +309,12 @@ signal an error if not." (luna-define-internal-accessors 'lunit-test-reporter)) -(defun lunit-test-reporter-format-sexp (sexp) - (with-temp-buffer - (insert (pp-to-string sexp)) - (goto-char (point-min)) - (while (re-search-forward "\\\\" nil t) - (replace-match "\\\\" nil t)) - (goto-char (point-min)) - (while (re-search-forward "\"" nil t) - (replace-match """ nil t)) - (buffer-string))) +(defun lunit-escape-quote (string) + (let ((index 0)) + (while (string-match "\"" string index) + (setq string (replace-match """ nil t string) + index (+ 5 index))) + string)) (luna-define-method lunit-test-listener-error ((reporter lunit-test-reporter) case error) @@ -325,7 +323,7 @@ signal an error if not." (insert (format "\ " - (lunit-test-reporter-format-sexp error))))) + (lunit-escape-quote (pp-to-string error)))))) (luna-define-method lunit-test-listener-failure ((reporter lunit-test-reporter) case failure) @@ -334,7 +332,7 @@ signal an error if not." (insert (format "\ " - (lunit-test-reporter-format-sexp failure))))) + (lunit-escape-quote (pp-to-string failure)))))) (luna-define-method lunit-test-listener-start ((reporter lunit-test-reporter) case) @@ -405,12 +403,16 @@ signal an error if not." + + + " (lunit-test-number-of-tests test) (length failures) (length errors) (+ (nth 1 elapsed) - (/ (nth 2 elapsed) 1000000.0)))) + (/ (nth 2 elapsed) 1000000.0)) + (lunit-escape-quote (emacs-version)))) (goto-char (point-max)) (insert "\