emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master d09cbce 1/2: Make compile-tests re-runnable


From: Mattias Engdegård
Subject: [Emacs-diffs] master d09cbce 1/2: Make compile-tests re-runnable
Date: Fri, 4 Oct 2019 09:43:49 -0400 (EDT)

branch: master
commit d09cbcee9ce90171a20a3cae4a27dc08dcb1af41
Author: Mattias Engdegård <address@hidden>
Commit: Mattias Engdegård <address@hidden>

    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 0d4f7f2..3ff4521 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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]