]> code.delx.au - gnu-emacs/blobdiff - test/automated/pcase-tests.el
Update copyright year to 2015
[gnu-emacs] / test / automated / pcase-tests.el
index 7e3c40235e60a72100f9250ecb0b87a43c7fd0f5..701bcccc0e6d206d4e1c0fe366f5f3cd7dd7b6c4 100644 (file)
@@ -1,6 +1,6 @@
 ;;; 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))
 
@@ -58,6 +64,8 @@
     (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