diff options
| author | Mattias EngdegÄrd | 2024-11-06 13:29:23 +0100 |
|---|---|---|
| committer | Eli Zaretskii | 2024-11-06 15:27:33 +0200 |
| commit | e88309eef30abca327c845fe4133d758d33cfb6b (patch) | |
| tree | e6cd7619246c7b35e1b8af0ec9dd9f23e3e69cd7 /test/lisp | |
| parent | 3231af3727b450404efd6f49ddf5c95c5a8cbb0f (diff) | |
| download | emacs-e88309eef30abca327c845fe4133d758d33cfb6b.tar.gz emacs-e88309eef30abca327c845fe4133d758d33cfb6b.zip | |
Fix wrong value of `when` and `unless` with empty body (bug#74215)
* lisp/subr.el (when, unless): Return nil when the body is empty.
Reported by Brennan Vincent.
* test/lisp/subr-tests.el (subr-test-when): Add test cases.
(cherry picked from commit 9ee9154247454c18f9f75d0d32592b817d7e977a)
Diffstat (limited to 'test/lisp')
| -rw-r--r-- | test/lisp/subr-tests.el | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/test/lisp/subr-tests.el b/test/lisp/subr-tests.el index 6f28e057342..e12e3c62e0c 100644 --- a/test/lisp/subr-tests.el +++ b/test/lisp/subr-tests.el | |||
| @@ -454,7 +454,11 @@ | |||
| 454 | x))) | 454 | x))) |
| 455 | (should (= x 2))) | 455 | (should (= x 2))) |
| 456 | (should (equal (macroexpand-all '(when a b c d)) | 456 | (should (equal (macroexpand-all '(when a b c d)) |
| 457 | '(if a (progn b c d))))) | 457 | '(if a (progn b c d)))) |
| 458 | (with-suppressed-warnings ((empty-body when unless)) | ||
| 459 | (should (equal (when t) nil)) | ||
| 460 | (should (equal (unless t) nil)) | ||
| 461 | (should (equal (unless nil) nil)))) | ||
| 458 | 462 | ||
| 459 | (ert-deftest subr-test-xor () | 463 | (ert-deftest subr-test-xor () |
| 460 | "Test `xor'." | 464 | "Test `xor'." |