diff options
author | Stefan Kangas <stefankangas@gmail.com> | 2020-08-13 22:02:18 +0200 |
---|---|---|
committer | Stefan Kangas <stefankangas@gmail.com> | 2020-08-13 22:04:59 +0200 |
commit | 727ffbaaf44b001f6b4be49f33dfb784675bada3 (patch) | |
tree | 9a3e250fb7b4fbdd52b899b5fb7d73b24fe43f9d /test/lisp | |
parent | 1591b8ab9a0516a5e9b7a2dd66daddf479b75762 (diff) | |
download | emacs-727ffbaaf44b001f6b4be49f33dfb784675bada3.tar.gz emacs-727ffbaaf44b001f6b4be49f33dfb784675bada3.tar.bz2 emacs-727ffbaaf44b001f6b4be49f33dfb784675bada3.zip |
Add tests for cl-{incf,decf}
* test/lisp/emacs-lisp/cl-lib-tests.el (cl-lib-test-incf)
(cl-lib-test-decf): New tests.
Diffstat (limited to 'test/lisp')
-rw-r--r-- | test/lisp/emacs-lisp/cl-lib-tests.el | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/lisp/emacs-lisp/cl-lib-tests.el b/test/lisp/emacs-lisp/cl-lib-tests.el index 57b9d23efb0..40dd7e4eeb0 100644 --- a/test/lisp/emacs-lisp/cl-lib-tests.el +++ b/test/lisp/emacs-lisp/cl-lib-tests.el @@ -242,6 +242,22 @@ (should (= (cl-the integer (cl-incf side-effect)) 1)) (should (= side-effect 1)))) +(ert-deftest cl-lib-test-incf () + (let ((var 0)) + (should (= (cl-incf var) 1)) + (should (= var 1))) + (let ((alist)) + (should (= (cl-incf (alist-get 'a alist 0)) 1)) + (should (= (alist-get 'a alist 0) 1)))) + +(ert-deftest cl-lib-test-decf () + (let ((var 1)) + (should (= (cl-decf var) 0)) + (should (= var 0))) + (let ((alist)) + (should (= (cl-decf (alist-get 'a alist 0)) -1)) + (should (= (alist-get 'a alist 0) -1)))) + (ert-deftest cl-lib-test-plusp () (should-not (cl-plusp -1.0e+INF)) (should-not (cl-plusp -1.5e2)) |