diff options
| author | João Távora | 2017-11-11 23:44:52 +0000 |
|---|---|---|
| committer | João Távora | 2017-11-11 23:44:52 +0000 |
| commit | e286b3381fa1be64174832560da963b1c0191640 (patch) | |
| tree | 868f64028e662664e8d47d21027213f812f20d68 /test | |
| parent | 9533d76b0b5bfe2df1cccc55a92c2545b1de4e2b (diff) | |
| download | emacs-e286b3381fa1be64174832560da963b1c0191640.tar.gz emacs-e286b3381fa1be64174832560da963b1c0191640.zip | |
Fix more flymake-diag-region eob corner cases and add tests (bug#29201)
* lisp/progmodes/flymake.el (flymake-diag-region): Correct
more eob corner cases.
* test/lisp/progmodes/flymake-tests.el
(eob-region-and-trailing-newline): New test.
Diffstat (limited to 'test')
| -rw-r--r-- | test/lisp/progmodes/flymake-tests.el | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/test/lisp/progmodes/flymake-tests.el b/test/lisp/progmodes/flymake-tests.el index 05214e7a927..bc194b69ccb 100644 --- a/test/lisp/progmodes/flymake-tests.el +++ b/test/lisp/progmodes/flymake-tests.el | |||
| @@ -333,6 +333,38 @@ SEVERITY-PREDICATE is used to setup | |||
| 333 | (should-error (flymake-goto-prev-error nil nil t)) | 333 | (should-error (flymake-goto-prev-error nil nil t)) |
| 334 | ))))) | 334 | ))))) |
| 335 | 335 | ||
| 336 | (ert-deftest eob-region-and-trailing-newline () | ||
| 337 | "`flymake-diag-region' at eob with varying trailing newlines." | ||
| 338 | (cl-flet ((diag-region-substring | ||
| 339 | (line col) | ||
| 340 | (pcase-let | ||
| 341 | ((`(,a . ,b) (flymake-diag-region (current-buffer) line col))) | ||
| 342 | (buffer-substring a b)))) | ||
| 343 | (with-temp-buffer | ||
| 344 | (insert "beg\nmmm\nend") | ||
| 345 | (should (equal | ||
| 346 | (diag-region-substring 3 3) | ||
| 347 | "d")) | ||
| 348 | (should (equal | ||
| 349 | (diag-region-substring 3 nil) | ||
| 350 | "end")) | ||
| 351 | (insert "\n") | ||
| 352 | (should (equal | ||
| 353 | (diag-region-substring 4 1) | ||
| 354 | "end")) | ||
| 355 | (should (equal | ||
| 356 | (diag-region-substring 4 nil) | ||
| 357 | "end")) | ||
| 358 | (insert "\n") | ||
| 359 | (should (equal | ||
| 360 | (diag-region-substring 5 1) | ||
| 361 | "\n")) | ||
| 362 | (should (equal | ||
| 363 | (diag-region-substring 5 nil) | ||
| 364 | "\n"))))) | ||
| 365 | |||
| 366 | |||
| 367 | |||
| 336 | (provide 'flymake-tests) | 368 | (provide 'flymake-tests) |
| 337 | 369 | ||
| 338 | ;;; flymake.el ends here | 370 | ;;; flymake.el ends here |