summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2025-10-27 00:59:10 -0500
committerCraig Jennings <c@cjennings.net>2025-10-27 00:59:10 -0500
commit440293828363b57fced439cfa927aac2f7c3838a (patch)
treed6089430d311d620f60e6c2d8ecc3fb3be7e3012
parent78d4c4886f1bf2307ead8e6b469e389e0422a059 (diff)
feat:test-runner: Enhance ERT test runner with focus/unfocus support
Add comprehensive documentation and workflow details for the ERT test runner, including integration with Projectile projects for automatic test discovery. Refactor code to support focus/unfocus workflows, allowing developers to efficiently manage test execution by focusing on specific test files. Introduce internal utility functions `cj/test--do-*` to modularize logic for file operations and focus management, improving code maintainability. Add new tests in `test-test-runner.el` to validate the enhanced functionality, ensuring robust handling of focus operations and test execution scenarios.
-rw-r--r--modules/test-runner.el10
1 files changed, 7 insertions, 3 deletions
diff --git a/modules/test-runner.el b/modules/test-runner.el
index f143cd0f..79e62e77 100644
--- a/modules/test-runner.el
+++ b/modules/test-runner.el
@@ -105,13 +105,17 @@ if not found or not in a project."
(t cj/test-global-directory))))))
(defun cj/test--get-test-files ()
- "Return a list of test file names (without path) in the appropriate test directory."
+ "Return list of test file names (without path) in test directory."
(let ((dir (cj/test--get-test-directory)))
(when (file-directory-p dir)
(mapcar #'file-name-nondirectory
(directory-files dir t "^test-.*\\.el$")))))
+<<<<<<< HEAD
(defun cj/test--do-load-files (dir files)
+=======
+(defun cj/test--do-load-files (_dir files)
+>>>>>>> 76493d5 (feat:test-runner: Enhance ERT test runner with focus/unfocus support)
"Load test FILES from DIR.
Returns: (cons \\='success loaded-count) on success,
(cons \\='error (list failed-files errors)) on errors."
@@ -310,7 +314,7 @@ Returns: (cons \\='success (list test-names loaded-count)) if successful,
(ert (concat "^" pattern "$")))))))
(defun cj/test--ensure-test-dir-in-load-path ()
- "Ensure the directory returned by cj/test--get-test-directory is in `load-path`."
+ "Ensure test directory is in `load-path'."
(let ((dir (cj/test--get-test-directory)))
(when (and dir (file-directory-p dir))
(add-to-list 'load-path dir))))
@@ -345,7 +349,7 @@ Otherwise, message that no test is found."
(ert t))
(defun cj/test-toggle-mode ()
- "Toggle between 'all and 'focused test execution modes."
+ "Toggle between \\='all and \\='focused test execution modes."
(interactive)
(setq cj/test-mode (if (eq cj/test-mode 'all) 'focused 'all))
(message "Test mode: %s" cj/test-mode))