diff options
author | Stefan Kangas <stefankangas@gmail.com> | 2025-02-22 16:55:06 +0100 |
---|---|---|
committer | Stefan Kangas <stefankangas@gmail.com> | 2025-02-22 16:55:54 +0100 |
commit | 8b6797fa01bf8c8c64bd1f72c1e2475bf2331ad9 (patch) | |
tree | 949b49b3de169fd501e010e7dde584836a8373ed /test/lisp/emacs-lisp/cl-lib-tests.el | |
parent | ef8fdd269a244f94f970f51c909eff5de4702048 (diff) | |
download | emacs-8b6797fa01bf8c8c64bd1f72c1e2475bf2331ad9.tar.gz emacs-8b6797fa01bf8c8c64bd1f72c1e2475bf2331ad9.tar.bz2 emacs-8b6797fa01bf8c8c64bd1f72c1e2475bf2331ad9.zip |
Expand tests for cl-incf and cl-decf
* test/lisp/emacs-lisp/cl-lib-tests.el (cl-lib-test-incf)
(cl-lib-test-decf): Expand tests.
Diffstat (limited to 'test/lisp/emacs-lisp/cl-lib-tests.el')
-rw-r--r-- | test/lisp/emacs-lisp/cl-lib-tests.el | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/test/lisp/emacs-lisp/cl-lib-tests.el b/test/lisp/emacs-lisp/cl-lib-tests.el index ff19ec74a43..376566958a0 100644 --- a/test/lisp/emacs-lisp/cl-lib-tests.el +++ b/test/lisp/emacs-lisp/cl-lib-tests.el @@ -63,21 +63,41 @@ (should (equal (cl-multiple-value-list nil) nil)) (should (equal (cl-multiple-value-list (list 1 2 3)) '(1 2 3)))) +(defvar cl-lib-test--special 0) + (ert-deftest cl-lib-test-incf () + (setq cl-lib-test--special 0) + (should (= (cl-incf cl-lib-test--special) 1)) + (should (= cl-lib-test--special 1)) + (should (= (cl-incf cl-lib-test--special 9) 10)) + (should (= cl-lib-test--special 10)) (let ((var 0)) (should (= (cl-incf var) 1)) - (should (= var 1))) + (should (= var 1)) + (should (= (cl-incf var 9) 10)) + (should (= var 10))) (let ((alist)) (should (= (cl-incf (alist-get 'a alist 0)) 1)) - (should (= (alist-get 'a alist 0) 1)))) + (should (= (alist-get 'a alist 0) 1)) + (should (= (cl-incf (alist-get 'a alist 0) 9) 10)) + (should (= (alist-get 'a alist 0) 10)))) (ert-deftest cl-lib-test-decf () + (setq cl-lib-test--special 0) + (should (= (cl-decf cl-lib-test--special) -1)) + (should (= cl-lib-test--special -1)) + (should (= (cl-decf cl-lib-test--special 9) -10)) + (should (= cl-lib-test--special -10)) (let ((var 1)) (should (= (cl-decf var) 0)) - (should (= var 0))) + (should (= var 0)) + (should (= (cl-decf var 10) -10)) + (should (= var -10))) (let ((alist)) (should (= (cl-decf (alist-get 'a alist 0)) -1)) - (should (= (alist-get 'a alist 0) -1)))) + (should (= (alist-get 'a alist 0) -1)) + (should (= (cl-decf (alist-get 'a alist 0) 9) -10)) + (should (= (alist-get 'a alist 0) -10)))) (ert-deftest cl-digit-char-p () (should (eql 3 (cl-digit-char-p ?3))) |