From d09cbcee9ce90171a20a3cae4a27dc08dcb1af41 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Mattias=20Engdeg=C3=A5rd?= Date: Fri, 4 Oct 2019 15:23:13 +0200 Subject: [PATCH] Make compile-tests re-runnable * test/lisp/progmodes/compile-tests.el (compile-test-error-regexps): Don't rely on compilation-num-errors (etc) all being zero, which they aren't if the test has been run before. (compile-tests--test-regexps-data): Change defvar to defconst. --- test/lisp/progmodes/compile-tests.el | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/test/lisp/progmodes/compile-tests.el b/test/lisp/progmodes/compile-tests.el index 0d4f7f2ff28..3ff4521d2d8 100644 --- a/test/lisp/progmodes/compile-tests.el +++ b/test/lisp/progmodes/compile-tests.el @@ -30,7 +30,7 @@ (require 'ert) (require 'compile) -(defvar compile-tests--test-regexps-data +(defconst compile-tests--test-regexps-data ;; The computed column numbers are zero-indexed, so subtract 1 from ;; what's reported in the string. The end column numbers are for ;; the character after, so it matches what's reported in the string. @@ -401,10 +401,13 @@ can only work with the NUL byte to disambiguate colons.") The test data is in `compile-tests--test-regexps-data'." (with-temp-buffer (font-lock-mode -1) - (mapc #'compile--test-error-line compile-tests--test-regexps-data) - (should (eq compilation-num-errors-found 87)) - (should (eq compilation-num-warnings-found 32)) - (should (eq compilation-num-infos-found 20)))) + (let ((compilation-num-errors-found 0) + (compilation-num-warnings-found 0) + (compilation-num-infos-found 0)) + (mapc #'compile--test-error-line compile-tests--test-regexps-data) + (should (eq compilation-num-errors-found 87)) + (should (eq compilation-num-warnings-found 32)) + (should (eq compilation-num-infos-found 20))))) (ert-deftest compile-test-grep-regexps () "Test the `grep-regexp-alist' regexps. -- 2.39.2