summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMattias EngdegÄrd <mattiase@acm.org>2019-10-04 15:23:13 +0200
committerMattias EngdegÄrd <mattiase@acm.org>2019-10-04 15:43:15 +0200
commitd09cbcee9ce90171a20a3cae4a27dc08dcb1af41 (patch)
tree555b7397e55cde0275993eae0f0dc71875116433
parent5f06b9c478894c828fc5467b0aae360e2c2d1fd2 (diff)
downloademacs-d09cbcee9ce90171a20a3cae4a27dc08dcb1af41.tar.gz
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.
-rw-r--r--test/lisp/progmodes/compile-tests.el13
1 files 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.