;;; pcase-tests.el --- Test suite for pcase macro.
-;; Copyright (C) 2012-2014 Free Software Foundation, Inc.
+;; Copyright (C) 2012-2015 Free Software Foundation, Inc.
;; This file is part of GNU Emacs.
"Test pcase code."
(should (equal (pcase '(1 . 2) ((app car '2) 6) ((app car '1) 5)) 5)))
+(ert-deftest pcase-tests-bugs ()
+ (should (equal (pcase '(2 . 3) ;bug#18554
+ (`(,hd . ,(and (pred atom) tl)) (list hd tl))
+ ((pred consp) nil))
+ '(2 3))))
+
(pcase-defmacro pcase-tests-plus (pat n)
`(app (lambda (v) (- v ,n)) ,pat))
(should-not (pcase-tests-grep 'memq exp))
(should-not (pcase-tests-grep 'member exp))))
+(ert-deftest pcase-tests-vectors ()
+ (should (equal (pcase [1 2] (`[,x] 1) (`[,x ,y] (+ x y))) 3)))
;; Local Variables:
;; no-byte-compile: t