From 29c21851bddf76c5fd659d4225bb426fc1396750 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Thu, 30 Apr 2026 00:22:24 -0500 Subject: chore: add Cask + ert-runner test infrastructure Replace the bare emacs --batch test runner with cask exec ert-runner. The Makefile test targets now delegate. validate-parens, compile, and lint stay on bare emacs --batch. Running cask once per file would slow them down for no real win. Adds: - Cask file declaring sources and ert-runner as a dev dep - .ert-runner config adding . and tests to load-path - tests/test-helper.el placeholder for future test setup - .gitignore entry for .cask/ All 88 tests pass in 0.19s via the new path. --- Makefile | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 047039a..098f259 100644 --- a/Makefile +++ b/Makefile @@ -10,11 +10,12 @@ TEST_FILES = $(wildcard tests/test-*.el) UNIT_TESTS = $(filter-out tests/test-integration-%.el,$(TEST_FILES)) INTEGRATION_TESTS = $(wildcard tests/test-integration-*.el) -.PHONY: help test test-unit test-integration test-file test-name validate-parens compile lint clean +.PHONY: help test test-unit test-integration test-file test-name validate-parens compile lint clean install help: @echo "Targets:" - @echo " make test Run all tests" + @echo " make install Install dev deps via Cask" + @echo " make test Run all tests via cask exec ert-runner" @echo " make test-unit Unit tests only" @echo " make test-integration Integration tests only" @echo " make test-file FILE=path/to/test-foo.el Run one test file" @@ -24,22 +25,26 @@ help: @echo " make lint elisp-lint pass" @echo " make clean Remove .elc" +install: + @cask install + test: - @$(EMACS) $(EMACSFLAGS) $(LOADPATH) -l ert $(addprefix -l ,$(TEST_FILES)) -f ert-run-tests-batch-and-exit + @cask exec ert-runner $(TEST_FILES) test-unit: - @$(EMACS) $(EMACSFLAGS) $(LOADPATH) -l ert $(addprefix -l ,$(UNIT_TESTS)) -f ert-run-tests-batch-and-exit + @cask exec ert-runner $(UNIT_TESTS) test-integration: - @$(EMACS) $(EMACSFLAGS) $(LOADPATH) -l ert $(addprefix -l ,$(INTEGRATION_TESTS)) -f ert-run-tests-batch-and-exit + @if [ -z "$(INTEGRATION_TESTS)" ]; then echo "No integration tests yet."; exit 0; fi + @cask exec ert-runner $(INTEGRATION_TESTS) test-file: @if [ -z "$(FILE)" ]; then echo "Usage: make test-file FILE=tests/test-NAME.el"; exit 1; fi - @$(EMACS) $(EMACSFLAGS) $(LOADPATH) -l ert -l "$(FILE)" -f ert-run-tests-batch-and-exit + @cask exec ert-runner "$(FILE)" test-name: @if [ -z "$(TEST)" ]; then echo "Usage: make test-name TEST=pattern"; exit 1; fi - @$(EMACS) $(EMACSFLAGS) $(LOADPATH) -l ert $(addprefix -l ,$(TEST_FILES)) --eval "(ert-run-tests-batch-and-exit \"$(TEST)\")" + @cask exec ert-runner --pattern "$(TEST)" $(TEST_FILES) validate-parens: @for f in $(PACKAGE_FILES) $(TEST_FILES); do \ -- cgit v1.2.3