diff options
| -rw-r--r-- | tests/Makefile | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/tests/Makefile b/tests/Makefile index a6b6812..c011359 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -93,11 +93,19 @@ ifndef FILE @echo " make test-file FILE=test-pearl-mapping.el" @exit 1 endif - @TESTFILE=$$(find . -maxdepth 1 -name "*$(FILE)*.el" -type f | head -1 | sed 's|^\./||'); \ + @TESTFILE=$$( \ + if [ -f "$(FILE)" ]; then echo "$(FILE)"; \ + elif [ -f "$(FILE).el" ]; then echo "$(FILE).el"; \ + else find . -maxdepth 1 -name "*$(FILE)*.el" -type f | sed 's|^\./||'; fi); \ if [ -z "$$TESTFILE" ]; then \ printf "$(RED)Error: No test file matching '$(FILE)' found$(NC)\n"; \ exit 1; \ fi; \ + if [ "$$(printf '%s\n' "$$TESTFILE" | grep -c .)" -gt 1 ]; then \ + printf "$(RED)Error: '$(FILE)' matches multiple files; pass the exact name (e.g. $(FILE).el):$(NC)\n"; \ + printf '%s\n' "$$TESTFILE" | sed 's|^| |'; \ + exit 1; \ + fi; \ printf "$(YELLOW)Running tests in $$TESTFILE...$(NC)\n"; \ $(EMACS_BATCH) -l ert -l "$$TESTFILE" \ --eval "$(ERT_FAST_SELECTOR)" 2>&1 | tee $(PROJECT_ROOT)/tests/test-file-output.log; \ |
