diff options
| author | João Távora | 2017-08-20 12:19:45 +0100 |
|---|---|---|
| committer | João Távora | 2017-10-03 13:51:05 +0100 |
| commit | bbcb079522e12d8b9d416a8472a2966cc6d83a5a (patch) | |
| tree | 636dcbb723e3e87f3b2bd06e67b9e19d94d1e4cd | |
| parent | 1c30f9fc08649649676ed812f1579f0948558ceb (diff) | |
| download | emacs-bbcb079522e12d8b9d416a8472a2966cc6d83a5a.tar.gz emacs-bbcb079522e12d8b9d416a8472a2966cc6d83a5a.zip | |
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.
| -rw-r--r-- | test/lisp/progmodes/flymake-tests.el | 19 |
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 @@ | |||
| 26 | (require 'flymake) | 26 | (require 'flymake) |
| 27 | 27 | ||
| 28 | (defvar flymake-tests-data-directory | 28 | (defvar flymake-tests-data-directory |
| 29 | (expand-file-name "lisp/progmodes/flymake-resources" (getenv "EMACS_TEST_DIRECTORY")) | 29 | (expand-file-name "lisp/progmodes/flymake-resources" |
| 30 | (or (getenv "EMACS_TEST_DIRECTORY") | ||
| 31 | (expand-file-name "../../.." | ||
| 32 | (or load-file-name | ||
| 33 | buffer-file-name)))) | ||
| 30 | "Directory containing flymake test data.") | 34 | "Directory containing flymake test data.") |
| 31 | 35 | ||
| 32 | 36 | ||
| @@ -41,8 +45,17 @@ | |||
| 41 | (setq-local flymake-proc-warning-predicate predicate) | 45 | (setq-local flymake-proc-warning-predicate predicate) |
| 42 | (goto-char (point-min)) | 46 | (goto-char (point-min)) |
| 43 | (flymake-mode 1) | 47 | (flymake-mode 1) |
| 44 | ;; Weirdness here... https://debbugs.gnu.org/17647#25 | 48 | ;; Weirdness here... http://debbugs.gnu.org/17647#25 |
| 49 | ;; ... meaning `sleep-for', and even | ||
| 50 | ;; `accept-process-output', won't suffice as ways to get | ||
| 51 | ;; process filters and sentinels to run, though they do work | ||
| 52 | ;; fine in a non-interactive batch session. The only thing | ||
| 53 | ;; that will indeed unblock pending process output is | ||
| 54 | ;; reading an input event, so, as a workaround, use a dummy | ||
| 55 | ;; `read-event' with a very short timeout. | ||
| 56 | (unless noninteractive (read-event "" nil 0.1)) | ||
| 45 | (while (and flymake-is-running (< (setq i (1+ i)) 10)) | 57 | (while (and flymake-is-running (< (setq i (1+ i)) 10)) |
| 58 | (unless noninteractive (read-event "" nil 0.1)) | ||
| 46 | (sleep-for (+ 0.5 flymake-no-changes-timeout))) | 59 | (sleep-for (+ 0.5 flymake-no-changes-timeout))) |
| 47 | (flymake-goto-next-error) | 60 | (flymake-goto-next-error) |
| 48 | (face-at-point)) | 61 | (face-at-point)) |
| @@ -59,7 +72,7 @@ | |||
| 59 | (skip-unless (and (executable-find "gcc") (executable-find "make"))) | 72 | (skip-unless (and (executable-find "gcc") (executable-find "make"))) |
| 60 | (should (eq 'flymake-warning | 73 | (should (eq 'flymake-warning |
| 61 | (flymake-tests--current-face "test.c" | 74 | (flymake-tests--current-face "test.c" |
| 62 | (lambda (msg) (string-match "^[Ww]arning" msg)))))) | 75 | (lambda (msg) (string-match "^[Ww]arning" msg)))))) |
| 63 | 76 | ||
| 64 | (ert-deftest warning-predicate-rx-perl () | 77 | (ert-deftest warning-predicate-rx-perl () |
| 65 | "Test perl warning via regular expression predicate." | 78 | "Test perl warning via regular expression predicate." |