summaryrefslogtreecommitdiff
path: root/test/lisp/progmodes
diff options
context:
space:
mode:
authorJoão Távora <joaotavora@gmail.com>2017-08-20 12:19:45 +0100
committerJoão Távora <joaotavora@gmail.com>2017-10-03 13:51:05 +0100
commitbbcb079522e12d8b9d416a8472a2966cc6d83a5a (patch)
tree636dcbb723e3e87f3b2bd06e67b9e19d94d1e4cd /test/lisp/progmodes
parent1c30f9fc08649649676ed812f1579f0948558ceb (diff)
downloademacs-bbcb079522e12d8b9d416a8472a2966cc6d83a5a.tar.gz
Allow running Flymake tests from interactive sessions
* test/lisp/progmodes/flymake-tests.el (flymake-tests-data-directory): Expand to reasonable value if no EMACS_TEST_DIRECTORY. (flymake-tests--current-face): Work around "weirdness" of bug 17647 with read-event.
Diffstat (limited to 'test/lisp/progmodes')
-rw-r--r--test/lisp/progmodes/flymake-tests.el19
1 files changed, 16 insertions, 3 deletions
diff --git a/test/lisp/progmodes/flymake-tests.el b/test/lisp/progmodes/flymake-tests.el
index a018f11efd2..338e8e0f074 100644
--- a/test/lisp/progmodes/flymake-tests.el
+++ b/test/lisp/progmodes/flymake-tests.el
@@ -26,7 +26,11 @@
(require 'flymake)
(defvar flymake-tests-data-directory
- (expand-file-name "lisp/progmodes/flymake-resources" (getenv "EMACS_TEST_DIRECTORY"))
+ (expand-file-name "lisp/progmodes/flymake-resources"
+ (or (getenv "EMACS_TEST_DIRECTORY")
+ (expand-file-name "../../.."
+ (or load-file-name
+ buffer-file-name))))
"Directory containing flymake test data.")
@@ -41,8 +45,17 @@
(setq-local flymake-proc-warning-predicate predicate)
(goto-char (point-min))
(flymake-mode 1)
- ;; Weirdness here... https://debbugs.gnu.org/17647#25
+ ;; Weirdness here... http://debbugs.gnu.org/17647#25
+ ;; ... meaning `sleep-for', and even
+ ;; `accept-process-output', won't suffice as ways to get
+ ;; process filters and sentinels to run, though they do work
+ ;; fine in a non-interactive batch session. The only thing
+ ;; that will indeed unblock pending process output is
+ ;; reading an input event, so, as a workaround, use a dummy
+ ;; `read-event' with a very short timeout.
+ (unless noninteractive (read-event "" nil 0.1))
(while (and flymake-is-running (< (setq i (1+ i)) 10))
+ (unless noninteractive (read-event "" nil 0.1))
(sleep-for (+ 0.5 flymake-no-changes-timeout)))
(flymake-goto-next-error)
(face-at-point))
@@ -59,7 +72,7 @@
(skip-unless (and (executable-find "gcc") (executable-find "make")))
(should (eq 'flymake-warning
(flymake-tests--current-face "test.c"
- (lambda (msg) (string-match "^[Ww]arning" msg))))))
+ (lambda (msg) (string-match "^[Ww]arning" msg))))))
(ert-deftest warning-predicate-rx-perl ()
"Test perl warning via regular expression predicate."