emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 727ffba: Add tests for cl-{incf,decf}


From: Stefan Kangas
Subject: master 727ffba: Add tests for cl-{incf,decf}
Date: Thu, 13 Aug 2020 16:09:48 -0400 (EDT)

branch: master
commit 727ffbaaf44b001f6b4be49f33dfb784675bada3
Author: Stefan Kangas <stefankangas@gmail.com>
Commit: Stefan Kangas <stefankangas@gmail.com>

    Add tests for cl-{incf,decf}
    
    * test/lisp/emacs-lisp/cl-lib-tests.el (cl-lib-test-incf)
    (cl-lib-test-decf): New tests.
---
 test/lisp/emacs-lisp/cl-lib-tests.el | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/test/lisp/emacs-lisp/cl-lib-tests.el 
b/test/lisp/emacs-lisp/cl-lib-tests.el
index 57b9d23..40dd7e4 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))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]