aboutsummaryrefslogtreecommitdiffstats
path: root/test/src
diff options
context:
space:
mode:
authorMattias EngdegÄrd2022-07-17 19:05:03 +0200
committerMattias EngdegÄrd2022-07-18 12:49:29 +0200
commit5ad8f3e5709a3823371ea6aa039b5e7e50feca1f (patch)
tree96673038a2d4499755be7c31bed4c82c9784b1d8 /test/src
parent2d97fe271039358d24a779e5468a313ffcf6059a (diff)
downloademacs-5ad8f3e5709a3823371ea6aa039b5e7e50feca1f.tar.gz
emacs-5ad8f3e5709a3823371ea6aa039b5e7e50feca1f.zip
Use `take` where clearly safe to do so (bug#56521)
* lisp/emacs-lisp/seq.el (seq-take): * lisp/auth-source.el (auth-source-secrets-search) (auth-source-plstore-search): * lisp/gnus/message.el (message-insert-formatted-citation-line): * lisp/net/dbus.el (dbus-unregister-object): * lisp/replace.el (occur-context-lines): * test/src/print-tests.el (print-circular): Replace hand-written loop or `butlast` call with `take` for clarity, performance and validation. We have the equivalence (take N LIST) = (butlast LIST (- (length LIST) N)).
Diffstat (limited to 'test/src')
-rw-r--r--test/src/print-tests.el2
1 files changed, 1 insertions, 1 deletions
diff --git a/test/src/print-tests.el b/test/src/print-tests.el
index 6ff7e997837..f818b4d4715 100644
--- a/test/src/print-tests.el
+++ b/test/src/print-tests.el
@@ -514,7 +514,7 @@ otherwise, use a different charset."
514 (should (< lead (length numbers))) 514 (should (< lead (length numbers)))
515 (should (<= lead loopback-index)) 515 (should (<= lead loopback-index))
516 (should (< loopback-index (length numbers))) 516 (should (< loopback-index (length numbers)))
517 (let ((lead-part (butlast numbers (- (length numbers) lead))) 517 (let ((lead-part (take lead numbers))
518 (loop-part (nthcdr lead numbers))) 518 (loop-part (nthcdr lead numbers)))
519 ;; The lead part must match exactly. 519 ;; The lead part must match exactly.
520 (should (equal lead-part (number-sequence 1 lead))) 520 (should (equal lead-part (number-sequence 1 lead)))