summaryrefslogtreecommitdiff
path: root/test/lisp/emacs-lisp/pcase-tests.el
diff options
context:
space:
mode:
authorYuuki Harano <masm+github@masm11.me>2021-03-08 21:20:54 +0900
committerYuuki Harano <masm+github@masm11.me>2021-03-08 21:20:54 +0900
commit4dda6db3abf4a67455a007d28e14d62a9909f665 (patch)
tree88d4e316e81f5bdd8b6801ff89ea68cd164e4055 /test/lisp/emacs-lisp/pcase-tests.el
parent565995d408ca65ec9f981f175cca29d2164a5fd0 (diff)
parent432c1aaa80ce109250a93f50858a03ce3d01ca34 (diff)
downloademacs-4dda6db3abf4a67455a007d28e14d62a9909f665.tar.gz
emacs-4dda6db3abf4a67455a007d28e14d62a9909f665.tar.bz2
emacs-4dda6db3abf4a67455a007d28e14d62a9909f665.zip
Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs into feature/pgtk
Diffstat (limited to 'test/lisp/emacs-lisp/pcase-tests.el')
-rw-r--r--test/lisp/emacs-lisp/pcase-tests.el27
1 files changed, 24 insertions, 3 deletions
diff --git a/test/lisp/emacs-lisp/pcase-tests.el b/test/lisp/emacs-lisp/pcase-tests.el
index e6f4c097504..2120139ec18 100644
--- a/test/lisp/emacs-lisp/pcase-tests.el
+++ b/test/lisp/emacs-lisp/pcase-tests.el
@@ -75,8 +75,29 @@
(ert-deftest pcase-tests-vectors ()
(should (equal (pcase [1 2] (`[,x] 1) (`[,x ,y] (+ x y))) 3)))
-;; Local Variables:
-;; no-byte-compile: t
-;; End:
+(ert-deftest pcase-tests-bug14773 ()
+ (let ((f (lambda (x)
+ (pcase 'dummy
+ ((and (let var x) (guard var)) 'left)
+ ((and (let var (not x)) (guard var)) 'right)))))
+ (should (equal (funcall f t) 'left))
+ (should (equal (funcall f nil) 'right))))
+
+(ert-deftest pcase-tests-bug46786 ()
+ (let ((self 'outer))
+ (ignore self)
+ (should (equal (cl-macrolet ((show-self () `(list 'self self)))
+ (pcase-let ((`(,self ,_self2) '(inner "2")))
+ (show-self)))
+ '(self inner)))))
+
+(ert-deftest pcase-tests-or-vars ()
+ (let ((f (lambda (v)
+ (pcase v
+ ((or (and 'b1 (let x1 4) (let x2 5))
+ (and 'b2 (let y1 8) (let y2 9)))
+ (list x1 x2 y1 y2))))))
+ (should (equal (funcall f 'b1) '(4 5 nil nil)))
+ (should (equal (funcall f 'b2) '(nil nil 8 9)))))
;;; pcase-tests.el ends here.