diff options
| author | Richard Hansen | 2022-12-10 00:57:15 -0500 |
|---|---|---|
| committer | Eli Zaretskii | 2022-12-31 10:48:37 +0200 |
| commit | f59d012af7e607448fdb435fcb4becb6a6ebe665 (patch) | |
| tree | 021d328adcf28ef8afe9e952625ef35cb7b89893 /test | |
| parent | 24488bc4b275109d7132689a0714cfb11d05e512 (diff) | |
| download | emacs-f59d012af7e607448fdb435fcb4becb6a6ebe665.tar.gz emacs-f59d012af7e607448fdb435fcb4becb6a6ebe665.zip | |
whitespace: Use `define-globalized-minor-mode' for global mode
* lisp/whitespace.el (global-whitespace-mode): Fix interoperability
between `whitespace-mode' and `global-whitespace-mode' by using
`define-globalized-minor-mode'. (Bug#60334)
* test/lisp/whitespace-tests.el (whitespace-tests--global): Add a
regression test.
Diffstat (limited to 'test')
| -rw-r--r-- | test/lisp/whitespace-tests.el | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/lisp/whitespace-tests.el b/test/lisp/whitespace-tests.el index d72748cd0c9..3a53e025036 100644 --- a/test/lisp/whitespace-tests.el +++ b/test/lisp/whitespace-tests.el | |||
| @@ -57,6 +57,24 @@ buffer's content." | |||
| 57 | (whitespace-cleanup) | 57 | (whitespace-cleanup) |
| 58 | (buffer-string))) | 58 | (buffer-string))) |
| 59 | 59 | ||
| 60 | (ert-deftest whitespace-tests--global () | ||
| 61 | (let ((backup global-whitespace-mode) | ||
| 62 | (noninteractive nil) | ||
| 63 | (whitespace-enable-predicate (lambda () t))) | ||
| 64 | (unwind-protect | ||
| 65 | (progn | ||
| 66 | (global-whitespace-mode 1) | ||
| 67 | (ert-with-test-buffer-selected () | ||
| 68 | (normal-mode) | ||
| 69 | (should whitespace-mode) | ||
| 70 | (global-whitespace-mode -1) | ||
| 71 | (should (null whitespace-mode)) | ||
| 72 | (whitespace-mode 1) | ||
| 73 | (should whitespace-mode) | ||
| 74 | (global-whitespace-mode 1) | ||
| 75 | (should whitespace-mode))) | ||
| 76 | (global-whitespace-mode (if backup 1 -1))))) | ||
| 77 | |||
| 60 | (ert-deftest whitespace-cleanup-eob () | 78 | (ert-deftest whitespace-cleanup-eob () |
| 61 | (let ((whitespace-style '(empty))) | 79 | (let ((whitespace-style '(empty))) |
| 62 | (should (equal (whitespace-tests--cleanup-string "a\n") | 80 | (should (equal (whitespace-tests--cleanup-string "a\n") |