commit 5b4b6d2319fa8594d4c8dd3078a72b45ec0505b8 parent 40775ea8dc96d7e930626b7daf9f9cb199b77528 Author: KΓ©vin Le Gouguec <kevin.legouguec@gmail.com> Date: Wed, 14 Feb 2024 19:56:58 +0100 Add helper to run Emacs testcase It's probably more idiomatic to run a testcase you are developing in your own session, using 'M-x ert' commands? I figure starting a fresh Emacs cannot hurt. Diffstat:
| M | .emacs | | | 23 | +++++++++++++++++++++++ |
1 file changed, 23 insertions(+), 0 deletions(-)
diff --git a/.emacs b/.emacs @@ -474,6 +474,29 @@ (lambda () (ibuffer-switch-to-saved-filter-groups "my/ibuffer-groups"))) +;;; Development helpers. +(defun my/emacs-run-testcase () + (interactive) + (require 'which-func) + (let* ((emacs-root (project-root (project-current))) + (testfile (file-name-sans-extension + (file-relative-name + buffer-file-name (file-name-concat + emacs-root "test")))) + (cores (string-to-number + (shell-command-to-string "nproc --all"))) + (options + `(("SELECTOR" . ,(which-function)) + ("TEST_BACKTRACE_LINE_LENGTH" . nil))) + (options-list + (seq-map + (lambda (opt) (format "%s=%s" (car opt) (cdr opt))) + options)) + (compile-command + (format "make -j%s && make -C test %s %s" + cores testfile (string-join options-list " ")))) + (call-interactively 'project-compile))) + ;;; Helper functions and miscellaneous settings. ;;;; French quick toggle.