2004-11-28 Daiki Ueno <ueno@unixuser.org>
+ * 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 <ueno@unixuser.org>
+
* COMPILE (riece-test): Use lunit-report instead of lunit.
* test/lunit.el: Report test result as XML.
(eval-when-compile (require 'cl))
+(require 'pp)
+
;;; @ test
;;;
(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)
(insert (format "\
<error message=\"%s\" type=\"error\"/>
"
- (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)
(insert (format "\
<failure message=\"%s\" type=\"failure\"/>
"
- (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)
<testsuites>
<testsuite name=\"\" tests=\"%d\" failures=\"%d\" \
errors=\"%d\" time =\"%.03f\">
+ <properties>
+ <property name=\"emacs-version\" value=\"%s\"/>
+ </properties>
"
(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 "\
</testsuite>