[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] scratch/flymake-refactor 593d4303 23/52: Add a new flymake
From: |
Jo�o T�vora |
Subject: |
[Emacs-diffs] scratch/flymake-refactor 593d4303 23/52: Add a new flymake test for multiple errors and warnings |
Date: |
Sun, 1 Oct 2017 12:40:46 -0400 (EDT) |
branch: scratch/flymake-refactor
commit 593d4303304e6de3a92948d80d55e52d5e6a2ad9
Author: João Távora <address@hidden>
Commit: João Távora <address@hidden>
Add a new flymake test for multiple errors and warnings
* test/lisp/progmodes/flymake-tests.el
(flymake-tests--call-with-fixture): Save excursion.
(errors-and-warnings): New test.
* test/lisp/progmodes/flymake-resources/errors-and-warnings.c:
New test fixture.
---
.../flymake-resources/errors-and-warnings.c | 10 +++++
test/lisp/progmodes/flymake-tests.el | 48 ++++++++++++++--------
2 files changed, 42 insertions(+), 16 deletions(-)
diff --git a/test/lisp/progmodes/flymake-resources/errors-and-warnings.c
b/test/lisp/progmodes/flymake-resources/errors-and-warnings.c
new file mode 100644
index 0000000..6454dd2
--- /dev/null
+++ b/test/lisp/progmodes/flymake-resources/errors-and-warnings.c
@@ -0,0 +1,10 @@
+ int main()
+{
+ char c = 1000;
+ int bla;
+ /* The following line should have one warning and one error. The
+ warning spans the full line because gcc (at least 6.3.0) points
+ places the error at the =, which isn't a sexp.*/
+ char c; if (bla == (void*)3);
+ return c;
+}
diff --git a/test/lisp/progmodes/flymake-tests.el
b/test/lisp/progmodes/flymake-tests.el
index cbef584..7057288 100644
--- a/test/lisp/progmodes/flymake-tests.el
+++ b/test/lisp/progmodes/flymake-tests.el
@@ -49,23 +49,24 @@ SEVERITY-PREDICATE is used to setup
(i 0))
(unwind-protect
(with-current-buffer buffer
- (when sev-pred-supplied-p
- (setq-local flymake-proc-warning-predicate severity-predicate))
- (goto-char (point-min))
- (flymake-mode 1)
- ;; 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))
+ (save-excursion
+ (when sev-pred-supplied-p
+ (setq-local flymake-proc-warning-predicate severity-predicate))
+ (goto-char (point-min))
+ (flymake-mode 1)
+ ;; 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))
- (sleep-for (+ 0.5 flymake-no-changes-timeout)))
- (funcall fn))
+ (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)))
+ (funcall fn)))
(and buffer
(not visiting)
(let (kill-buffer-query-functions) (kill-buffer buffer))))))
@@ -114,6 +115,21 @@ SEVERITY-PREDICATE is used to setup
(should (eq 'flymake-warning
(face-at-point)))))
+(ert-deftest errors-and-warnings ()
+ "Test GCC warning via function predicate."
+ (skip-unless (and (executable-find "gcc") (executable-find "make")))
+ (flymake-tests--with-flymake
+ ("errors-and-warnings.c")
+ (flymake-goto-next-error)
+ (should (eq 'flymake-error (face-at-point)))
+ (flymake-goto-next-error)
+ (should (eq 'flymake-warning (face-at-point)))
+ (flymake-goto-next-error)
+ (should (eq 'flymake-warning (face-at-point)))
+ (flymake-goto-next-error)
+ (should (eq 'flymake-error (face-at-point)))
+ (should-error (flymake-goto-next-error nil t)) ))
+
(provide 'flymake-tests)
;;; flymake.el ends here
- [Emacs-diffs] scratch/flymake-refactor 991c88f 18/52: flymake-warning face easier to distinguish from flymake-error, (continued)
- [Emacs-diffs] scratch/flymake-refactor 991c88f 18/52: flymake-warning face easier to distinguish from flymake-error, Jo�o T�vora, 2017/10/01
- [Emacs-diffs] scratch/flymake-refactor 12aa247 19/52: Protect against timer triggers when no flymake-mode, Jo�o T�vora, 2017/10/01
- [Emacs-diffs] scratch/flymake-refactor 740572e 05/52: Completely rewrite flymake's subprocess output processing, Jo�o T�vora, 2017/10/01
- [Emacs-diffs] scratch/flymake-refactor 14db516 22/52: flymake-ui.el checks file names before considering diagnostics, Jo�o T�vora, 2017/10/01
- [Emacs-diffs] scratch/flymake-refactor 61ba20b 21/52: Echo flymake error messages when navigating errors interactively, Jo�o T�vora, 2017/10/01
- [Emacs-diffs] scratch/flymake-refactor b2c4135 15/52: Clarify logic around flymake-diagnostic-types-alist, Jo�o T�vora, 2017/10/01
- [Emacs-diffs] scratch/flymake-refactor bac7512 12/52: New flymake-diagnostic-types-alist and more cleanup, Jo�o T�vora, 2017/10/01
- [Emacs-diffs] scratch/flymake-refactor 7140018 25/52: Protect flymake-ui against commands like fill-paragraph, Jo�o T�vora, 2017/10/01
- [Emacs-diffs] scratch/flymake-refactor d3168cf 09/52: Make lisp/progmodes/flymake-ui.el some 150 lines lighter, Jo�o T�vora, 2017/10/01
- [Emacs-diffs] scratch/flymake-refactor f3b8a72 20/52: Refactor flymake-tests.el in preparation for more tests, Jo�o T�vora, 2017/10/01
- [Emacs-diffs] scratch/flymake-refactor 593d4303 23/52: Add a new flymake test for multiple errors and warnings,
Jo�o T�vora <=
- [Emacs-diffs] scratch/flymake-refactor d68448f 26/52: More cleanup before advancing to backend redesign, Jo�o T�vora, 2017/10/01
- [Emacs-diffs] scratch/flymake-refactor 245114e 33/52: Fix autoload conflict between flymake.el and flymake-ui.el, Jo�o T�vora, 2017/10/01
- [Emacs-diffs] scratch/flymake-refactor 4fea8a9 30/52: Allow filtering in flymake-goto-[next/prev]-error, Jo�o T�vora, 2017/10/01
- [Emacs-diffs] scratch/flymake-refactor 192cb7f 24/52: flymake-ui.el highlights GCC notes detected by flymake-proc.el, Jo�o T�vora, 2017/10/01
- [Emacs-diffs] scratch/flymake-refactor 879dcef 29/52: Misc cleanup in flymake-proc.el, Jo�o T�vora, 2017/10/01
- [Emacs-diffs] scratch/flymake-refactor 820b460 35/52: Add interactive flymake-start function, Jo�o T�vora, 2017/10/01
- [Emacs-diffs] scratch/flymake-refactor 8e42a5d 31/52: Cleanup some flymake-ui.el internals, Jo�o T�vora, 2017/10/01
- [Emacs-diffs] scratch/flymake-refactor e1b913f 36/52: Re-implement wraparound for flymake-goto-next-error, Jo�o T�vora, 2017/10/01
- [Emacs-diffs] scratch/flymake-refactor 3dfe11c 28/52: Simplify flymake logging and erroring., Jo�o T�vora, 2017/10/01
- [Emacs-diffs] scratch/flymake-refactor 9329265 40/52: Treat flymake errors as just another type of diagnostic, Jo�o T�vora, 2017/10/01