From cb9d93b91ced840c53c10db7dc863d0052f49ad4 Mon Sep 17 00:00:00 2001 From: ueno Date: Fri, 10 Nov 2000 06:43:07 +0000 Subject: [PATCH] * lunit.el (lunit-make-test-suite-from-class): New function. (lunit-class): Abolish. (lunit-test-results-buffer): Abolish. * Makefile (check): New target. --- ChangeLog | 17 +++++++++++++++++ FLIM-MK | 17 +++++++++++++++++ Makefile | 4 ++++ lunit.el | 28 ++++++++++++---------------- 4 files changed, 50 insertions(+), 16 deletions(-) diff --git a/ChangeLog b/ChangeLog index d922343..6fbd897 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,20 @@ +2000-11-10 Daiki Ueno + + * 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 + + * lunit.el (lunit-test-method-regexp): New variable. + (lunit-class): New function. + 2000-11-09 Daiki Ueno * lunit.el: New file. diff --git a/FLIM-MK b/FLIM-MK index 8270080..1dc86c9 100644 --- a/FLIM-MK +++ b/FLIM-MK @@ -40,6 +40,23 @@ LISPDIR=%s\n" PREFIX LISPDIR)) (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)) diff --git a/Makefile b/Makefile index 98c32ba..980a288 100644 --- a/Makefile +++ b/Makefile @@ -33,6 +33,10 @@ elc: $(EMACS) $(FLAGS) -f compile-flim $(PREFIX) $(LISPDIR) \ $(VERSION_SPECIFIC_LISPDIR) +check: + $(EMACS) $(FLAGS) -f check-flim $(PREFIX) $(LISPDIR) \ + $(VERSION_SPECIFIC_LISPDIR) + install: elc $(EMACS) $(FLAGS) -f install-flim $(PREFIX) $(LISPDIR) \ $(VERSION_SPECIFIC_LISPDIR) diff --git a/lunit.el b/lunit.el index 3ff5d4e..01052e8 100644 --- a/lunit.el +++ b/lunit.el @@ -37,7 +37,8 @@ ;; (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") @@ -250,8 +251,6 @@ TESTS holds a number of instances of `lunit-test'." `(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) @@ -274,8 +273,8 @@ Starting test `%S#%S'\n" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ")) -(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) @@ -283,8 +282,7 @@ Starting test `%S#%S'\n" (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." @@ -294,15 +292,13 @@ Starting test `%S#%S'\n" (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) -- 1.7.10.4