summaryrefslogtreecommitdiff
path: root/test/lisp/emacs-lisp/seq-tests.el
diff options
context:
space:
mode:
authorPhilip Kaludercic <philipk@posteo.net>2022-08-12 16:05:05 +0200
committerPhilip Kaludercic <philipk@posteo.net>2022-08-12 16:05:05 +0200
commit1823349e6a61b2997b27cdb1ff42c69739693455 (patch)
treeed09268f8e57ab9196ff59df000c5f1268e09853 /test/lisp/emacs-lisp/seq-tests.el
parentfaa7f03b0c5b6d2c51bb185cf5a0f422ba0fb956 (diff)
parent829b131e5b3ad3b077be9d31215770b251341c68 (diff)
downloademacs-1823349e6a61b2997b27cdb1ff42c69739693455.tar.gz
emacs-1823349e6a61b2997b27cdb1ff42c69739693455.tar.bz2
emacs-1823349e6a61b2997b27cdb1ff42c69739693455.zip
Merge remote-tracking branch 'origin/master' into feature/package+vc
Diffstat (limited to 'test/lisp/emacs-lisp/seq-tests.el')
-rw-r--r--test/lisp/emacs-lisp/seq-tests.el18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/lisp/emacs-lisp/seq-tests.el b/test/lisp/emacs-lisp/seq-tests.el
index 3b22e42df24..1a27467d292 100644
--- a/test/lisp/emacs-lisp/seq-tests.el
+++ b/test/lisp/emacs-lisp/seq-tests.el
@@ -559,5 +559,23 @@ Evaluate BODY for each created sequence.
(should (equal (seq-split seq 3)
'("012" "345" "678" "9")))))
+(ert-deftest test-seq-uniq-list ()
+ (let ((list '(1 2 3)))
+ (should (equal (seq-uniq (append list list)) '(1 2 3))))
+ (let ((list '(1 2 3 2 1)))
+ (should (equal (seq-uniq list) '(1 2 3))))
+ (let ((list (list (substring "1")
+ (substring "2")
+ (substring "3")
+ (substring "2")
+ (substring "1"))))
+ (should (equal (seq-uniq list) '("1" "2" "3")))
+ (should (equal (seq-uniq list #'eq) '("1" "2" "3" "2" "1"))))
+ ;; Long lists have a different code path.
+ (let ((list (seq-map-indexed (lambda (_ i) i)
+ (make-list 10000 nil))))
+ (should (= (length list) 10000))
+ (should (= (length (seq-uniq (append list list))) 10000))))
+
(provide 'seq-tests)
;;; seq-tests.el ends here