Skip to content
This repository has been archived by the owner on Jul 27, 2022. It is now read-only.

Commit

Permalink
Added test-case-find-all-tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
nschum committed Mar 30, 2009
1 parent 5ee8650 commit f4e7592
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions test-case-mode.el
Expand Up @@ -37,6 +37,7 @@
;; (add-to-list 'load-path "/path/to/test-case-mode")
;; (autoload 'test-case-mode "test-case-mode" nil t)
;; (autoload 'enable-test-case-mode-if-test "test-case-mode")
;; (autoload 'test-case-find-all-tests "test-case-mode" nil t)
;; (autoload 'test-case-compilation-finish-run-all "test-case-mode")
;;
;; To enable it automatically when opening test files:
Expand Down Expand Up @@ -501,6 +502,28 @@ and `test-case-mode-line-info-position'."

;;;###autoload(add-hook 'find-file-hook 'enable-test-case-mode-if-test)

;;;###autoload
(defun test-case-find-all-tests (directory)
"Find all test cases in DIRECTORY."
(interactive "DDirectory: ")
(dolist (file (directory-files directory t "^[^.]" t))
(if (file-directory-p file)
(test-case-find-all-tests file)
;; Detect back-end for file.
(let ((file-mode (assoc-default file auto-mode-alist 'string-match)))
(and file-mode
(with-temp-buffer
(insert-file-contents file)
;; Don't actually invoke major mode (because of the hooks).
(let ((major-mode file-mode)
(buffer-file-name file))
(test-case-detect-backend)))
(find-file-noselect file))))))

(defun test-case-kill-all-test-buffers ()
(interactive)
(mapc 'kill-buffer (test-case-buffer-list)))

;;; menu ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(defvar test-case-menu nil)
Expand Down

0 comments on commit f4e7592

Please sign in to comment.