From: Mattias EngdegÄrd Date: Fri, 4 Oct 2019 13:23:13 +0000 (+0200) Subject: Make compile-tests re-runnable X-Git-Tag: emacs-27.0.90~1284 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=d09cbcee9ce90171a20a3cae4a27dc08dcb1af41;p=emacs.git 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. --- 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.