summaryrefslogtreecommitdiff
path: root/test/lisp/emacs-lisp/cl-extra-tests.el
diff options
context:
space:
mode:
authorYuan Fu <casouri@gmail.com>2022-11-21 12:54:35 -0800
committerYuan Fu <casouri@gmail.com>2022-11-21 12:54:35 -0800
commitaaeaa310f0391f5a5193e1a3d6e026986c4f2c0c (patch)
tree67765b95359bfc462e95606043e6b0cea3bb7c49 /test/lisp/emacs-lisp/cl-extra-tests.el
parentb2ea38ab03e801859163b74a292aa75008e36541 (diff)
parentf176a36f4629b56c9fd9e3fc15aebd04a168c4f5 (diff)
downloademacs-aaeaa310f0391f5a5193e1a3d6e026986c4f2c0c.tar.gz
emacs-aaeaa310f0391f5a5193e1a3d6e026986c4f2c0c.tar.bz2
emacs-aaeaa310f0391f5a5193e1a3d6e026986c4f2c0c.zip
Merge remote-tracking branch 'savannah/master' into feature/tree-sitter
Diffstat (limited to 'test/lisp/emacs-lisp/cl-extra-tests.el')
-rw-r--r--test/lisp/emacs-lisp/cl-extra-tests.el24
1 files changed, 22 insertions, 2 deletions
diff --git a/test/lisp/emacs-lisp/cl-extra-tests.el b/test/lisp/emacs-lisp/cl-extra-tests.el
index 297e413d858..6a34cd681ec 100644
--- a/test/lisp/emacs-lisp/cl-extra-tests.el
+++ b/test/lisp/emacs-lisp/cl-extra-tests.el
@@ -32,8 +32,28 @@
(ert-deftest cl-getf ()
(let ((plist '(x 1 y nil)))
(should (eq (cl-getf plist 'x) 1))
- (should (eq (cl-getf plist 'y :none) nil))
- (should (eq (cl-getf plist 'z :none) :none))))
+ (should-not (cl-getf plist 'y :none))
+ (should (eq (cl-getf plist 'z :none) :none))
+ (should (eq (cl-incf (cl-getf plist 'x 10) 2) 3))
+ (should (equal plist '(x 3 y nil)))
+ (should-error (cl-incf (cl-getf plist 'y 10) 4) :type 'wrong-type-argument)
+ (should (equal plist '(x 3 y nil)))
+ (should (eq (cl-incf (cl-getf plist 'z 10) 5) 15))
+ (should (equal plist '(z 15 x 3 y nil))))
+ (let ((plist '(x 1 y)))
+ (should (eq (cl-getf plist 'x) 1))
+ (should (eq (cl-getf plist 'y :none) :none))
+ (should (eq (cl-getf plist 'z :none) :none))
+ (should (eq (cl-incf (cl-getf plist 'x 10) 2) 3))
+ (should (equal plist '(x 3 y)))
+ (should (eq (cl-incf (cl-getf plist 'y 10) 4) 14))
+ (should (equal plist '(y 14 x 3 y))))
+ (let ((plist '(x 1 y . 2)))
+ (should (eq (cl-getf plist 'x) 1))
+ (should (eq (cl-incf (cl-getf plist 'x 10) 2) 3))
+ (should (equal plist '(x 3 y . 2)))
+ (should-error (cl-getf plist 'y :none) :type 'wrong-type-argument)
+ (should-error (cl-getf plist 'z :none) :type 'wrong-type-argument)))
(ert-deftest cl-extra-test-mapc ()
(let ((lst '(a b c))