mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-15 10:30:25 -08:00
New macros incf and decf
* lisp/emacs-lisp/cl-lib.el (cl-incf, cl-decf): Move macros from here... * lisp/emacs-lisp/gv.el (incf, decf): ...to here. Make old names into aliases, documented as deprecated. * lisp/obsolete/cl.el: Don't alias incf and decf. * test/lisp/emacs-lisp/cl-lib-tests.el (cl-lib-test-incf) (cl-lib-test-decf): Move tests from here... * test/lisp/emacs-lisp/gv-tests.el (gv-incf, gv-decf): ...to here. * doc/lispref/numbers.texi (Arithmetic Operations): * lisp/emacs-lisp/shortdoc.el (number): Document incf and decf. * doc/lispref/variables.texi (Multisession Variables): * doc/misc/cl.texi (Organization, Modify Macros, Modify Macros) (Modify Macros, Macro Bindings, For Clauses, Property Lists) (Structures, Efficiency Concerns, Obsolete Setf Customization): Delete cl-incf and cl-decf documentation, moving any relevant parts to lispref. Delete some parts that seem to primarily regard implementation details that do not warrant inclusion in lispref. Update all examples to use incf/decf.
This commit is contained in:
parent
44a1c4a9ae
commit
95fee880e4
10 changed files with 135 additions and 161 deletions
|
|
@ -63,42 +63,6 @@
|
|||
(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 (= (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 (= (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 (= (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 (= (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)))
|
||||
(should (eql 10 (cl-digit-char-p ?a 11)))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue