summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMattias EngdegÄrd <mattiase@acm.org>2021-07-27 17:26:26 +0200
committerMattias EngdegÄrd <mattiase@acm.org>2021-07-27 17:32:23 +0200
commit949dd41c31dab69f7a5067bba324c28bb2cfbf8e (patch)
tree4bded5ff6a4692a1f41dd678a41a29caf34b19b6 /test
parent989937e1bc29ffec3835aee34c46479d25d0bf05 (diff)
downloademacs-949dd41c31dab69f7a5067bba324c28bb2cfbf8e.tar.gz
Fix mistake in switch-case generation of `null` (bug#49746)
Reported by Gregor Zattler. * lisp/emacs-lisp/bytecomp.el (byte-compile--cond-switch-prefix): Be more careful in the selection of equality. * test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-tests--test-cases): Add test case.
Diffstat (limited to 'test')
-rw-r--r--test/lisp/emacs-lisp/bytecomp-tests.el6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/lisp/emacs-lisp/bytecomp-tests.el b/test/lisp/emacs-lisp/bytecomp-tests.el
index 7c40f7ebca3..ee0f931c192 100644
--- a/test/lisp/emacs-lisp/bytecomp-tests.el
+++ b/test/lisp/emacs-lisp/bytecomp-tests.el
@@ -503,6 +503,12 @@
(:success 'good))
(1+ x))))
(funcall f 3))
+
+ ;; Check `not' in cond switch (bug#49746).
+ (mapcar (lambda (x) (cond ((equal x "a") 1)
+ ((member x '("b" "c")) 2)
+ ((not x) 3)))
+ '("a" "b" "c" "d" nil))
)
"List of expressions for cross-testing interpreted and compiled code.")