+2000-11-10 Daiki Ueno <ueno@unixuser.org>
+
+ * lunit.el (lunit-make-test-suite-from-class): New function.
+ (lunit-class): Abolish.
+ (lunit-test-results-buffer): Abolish.
+
+ * FLIM-ELS (check-flim): New function.
+
+ * Makefile (check): New target.
+
+ * tests: New directory.
+
+2000-11-09 Daiki Ueno <ueno@unixuser.org>
+
+ * lunit.el (lunit-test-method-regexp): New variable.
+ (lunit-class): New function.
+
2000-11-09 Daiki Ueno <ueno@unixuser.org>
* lunit.el: New file.
(install-elisp-modules flim-modules "./" FLIM_DIR)
)
+(defun check-flim ()
+ (config-flim)
+ (require 'lunit)
+ (let ((files (directory-files "tests" t))
+ (suite (lunit-make-test-suite)))
+ (while files
+ (if (file-regular-p (car files))
+ (progn
+ (load-file (car files))
+ (lunit-test-suite-add-test
+ suite (lunit-make-test-suite-from-class
+ (intern (file-name-sans-extension
+ (file-name-nondirectory
+ (car files))))))))
+ (setq files (cdr files)))
+ (lunit suite)))
+
(defun config-flim-package ()
(let (package-dir)
(and (setq package-dir (car command-line-args-left))
;; (luna-define-method test-2 ((case silly-test-case))
;; (lunit-assert (stringp "b")))
;;
-;; (lunit-class 'silly-test-case)
+;; (with-output-to-temp-buffer "*Lunit Results*"
+;; (lunit (lunit-make-test-suite-from-class 'silly-test-case)))
;; ______________________________________________________________________
;; Starting test `silly-test-case#test-1'
;; failure: (integerp "a")
`(unless ,condition
(signal 'lunit-failure (list ',condition-expr)))))
-(defvar lunit-test-results-buffer "*Lunit Results*")
-
(luna-define-class lunit-test-printer (lunit-test-listener))
(luna-define-method lunit-test-listener-error ((printer lunit-test-printer)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"))
-(defun lunit-class (class)
- "Run all test methods of the CLASS and display the result."
+(defun lunit-make-test-suite-from-class (class)
+ "Make a test suite from all test methods of the CLASS."
(let (tests)
(mapatoms
(lambda (symbol)
(null (get symbol 'luna-method-qualifier)))
(push (lunit-make-test-case class symbol) tests)))
(luna-class-obarray (luna-find-class class)))
- (lunit
- (apply #'lunit-make-test-suite tests))))
+ (apply #'lunit-make-test-suite tests)))
(defun lunit (test)
"Run TEST and display the result."
(lunit-make-test-result printer))
failures
errors)
- (with-output-to-temp-buffer lunit-test-results-buffer
- (lunit-test-run test result)
- (setq failures (lunit-test-result-failures-internal result)
- errors (lunit-test-result-errors-internal result))
- (princ (format "%d runs, %d failures, %d errors"
- (lunit-test-number-of-tests test)
- (length failures)
- (length errors))))
- nil))
+ (lunit-test-run test result)
+ (setq failures (lunit-test-result-failures-internal result)
+ errors (lunit-test-result-errors-internal result))
+ (princ (format "%d runs, %d failures, %d errors\n"
+ (lunit-test-number-of-tests test)
+ (length failures)
+ (length errors)))))
(provide 'lunit)