aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Kangas2020-08-13 22:02:18 +0200
committerStefan Kangas2020-08-13 22:04:59 +0200
commit727ffbaaf44b001f6b4be49f33dfb784675bada3 (patch)
tree9a3e250fb7b4fbdd52b899b5fb7d73b24fe43f9d
parent1591b8ab9a0516a5e9b7a2dd66daddf479b75762 (diff)
downloademacs-727ffbaaf44b001f6b4be49f33dfb784675bada3.tar.gz
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.
-rw-r--r--test/lisp/emacs-lisp/cl-lib-tests.el16
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 @@
242 (should (= (cl-the integer (cl-incf side-effect)) 1)) 242 (should (= (cl-the integer (cl-incf side-effect)) 1))
243 (should (= side-effect 1)))) 243 (should (= side-effect 1))))
244 244
245(ert-deftest cl-lib-test-incf ()
246 (let ((var 0))
247 (should (= (cl-incf var) 1))
248 (should (= var 1)))
249 (let ((alist))
250 (should (= (cl-incf (alist-get 'a alist 0)) 1))
251 (should (= (alist-get 'a alist 0) 1))))
252
253(ert-deftest cl-lib-test-decf ()
254 (let ((var 1))
255 (should (= (cl-decf var) 0))
256 (should (= var 0)))
257 (let ((alist))
258 (should (= (cl-decf (alist-get 'a alist 0)) -1))
259 (should (= (alist-get 'a alist 0) -1))))
260
245(ert-deftest cl-lib-test-plusp () 261(ert-deftest cl-lib-test-plusp ()
246 (should-not (cl-plusp -1.0e+INF)) 262 (should-not (cl-plusp -1.0e+INF))
247 (should-not (cl-plusp -1.5e2)) 263 (should-not (cl-plusp -1.5e2))