branch: scratch/editorconfig-cc commit 5153161a07469cd17ed904b3878817ddd372fbad Author: 10sr <8.slas...@gmail.com> Commit: Stefan Monnier <monn...@iro.umontreal.ca>
Add minor fixes to tests (#252) * Update Makefile targets * Update github actions task * Fix test macros * Update README --- .github/workflows/build.yaml | 2 +- Makefile | 14 ++++++++++---- README.md | 2 +- ert-tests/editorconfig-2.el | 7 ++++--- ert-tests/editorconfig.el | 7 ++++--- 5 files changed, 20 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 85d85b622d..35245b9c78 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -37,4 +37,4 @@ jobs: with: version: ${{ matrix.emacs_version }} - name: Run tests - run: make test + run: make check diff --git a/Makefile b/Makefile index 1fbf12d7a4..5e4c212744 100644 --- a/Makefile +++ b/Makefile @@ -15,7 +15,15 @@ MAIN_SRC = editorconfig.el SRCS = $(wildcard $(PROJECT_ROOT_DIR)/*.el) OBJS = $(SRCS:.el=.elc) -.PHONY: all clean test test-travis test-ert test-core test-metadata sandbox doc info +.PHONY: check \ + compile clean \ + test test-ert test-core \ + sandbox doc + +check: compile test + + +compile: $(OBJS) $(OBJS): %.elc: %.el $(EMACS) $(BATCHFLAGS) -f batch-byte-compile $^ @@ -30,12 +38,10 @@ doc/editorconfig.texi: README.md doc/header.txt cat doc/header.txt $@.body2 >$@ rm -f $@.body $@.body2 -test: test-ert test-core test-metadata $(OBJS) +test: test-ert test-core $(EMACS) $(BATCHFLAGS) -l editorconfig.el - - # ert test test-ert: $(ERT_TESTS) $(OBJS) $(EMACS) $(BATCHFLAGS) \ diff --git a/README.md b/README.md index 7619162717..a571908f5a 100644 --- a/README.md +++ b/README.md @@ -167,7 +167,7 @@ Please feel free to submit issues if you find such modes! Make and [CMake][] must be installed to run the tests locally: - $ make test + $ make check To start a new Emacs process with current `*.el` and without loading user init file, run: diff --git a/ert-tests/editorconfig-2.el b/ert-tests/editorconfig-2.el index f06aba49f0..782bc89aa5 100644 --- a/ert-tests/editorconfig-2.el +++ b/ert-tests/editorconfig-2.el @@ -13,9 +13,10 @@ "Visit PATH and evaluate BODY." (declare (indent 1) (debug t)) `(let ((buf (find-file-noselect ,path))) - (with-current-buffer buf - ,@body) - (kill-buffer buf))) + (unwind-protect + (with-current-buffer buf + ,@body) + (kill-buffer buf)))) ;;; interactive diff --git a/ert-tests/editorconfig.el b/ert-tests/editorconfig.el index 4d3745e98f..cb9b7dfa4a 100644 --- a/ert-tests/editorconfig.el +++ b/ert-tests/editorconfig.el @@ -11,9 +11,10 @@ "Visit PATH and evaluate BODY." (declare (indent 1) (debug t)) `(let ((buf (find-file-noselect ,path))) - (with-current-buffer buf - ,@body) - (kill-buffer buf))) + (unwind-protect + (with-current-buffer buf + ,@body) + (kill-buffer buf)))) (defvar editorconfig-ert-dir (concat default-directory