aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorLars Ingebrigtsen2022-01-17 12:40:43 +0100
committerLars Ingebrigtsen2022-01-17 15:47:50 +0100
commit39d4e1ca21f3270d4835d5efa8862efc618c4cd9 (patch)
treec7449bb32cc89e37d3ce8266ad4f135bda70d3a1 /test
parentab17e353253a88d92f68b3909b27ded9e536fb28 (diff)
downloademacs-39d4e1ca21f3270d4835d5efa8862efc618c4cd9.tar.gz
emacs-39d4e1ca21f3270d4835d5efa8862efc618c4cd9.zip
Move the Gnus range functions to a new range.el file
* lisp/emacs-lisp/range.el: New file. * lisp/gnus/gnus-agent.el (range): (gnus-agent-synchronize-group-flags): (gnus-agent-possibly-alter-active): (gnus-agent-fetch-headers): (gnus-agent-read-agentview): (gnus-agent-fetch-group-1): (gnus-agent-read-p): (gnus-agent-expire-group-1): (gnus-agent-retrieve-headers): Adjust callers. * lisp/gnus/gnus-art.el (range): (gnus-article-describe-bindings): * lisp/gnus/gnus-cloud.el (range): (gnus-cloud-available-chunks): * lisp/gnus/gnus-draft.el (gnus-group-send-queue): * lisp/gnus/gnus-group.el (range): (gnus-group-line-format-alist): (gnus-number-of-unseen-articles-in-group): (gnus-group-update-eval-form): (gnus-group-read-group): (gnus-group-delete-articles): (gnus-group-catchup): (gnus-group-expire-articles-1): (gnus-add-marked-articles): * lisp/gnus/gnus-int.el (gnus-request-marks): * lisp/gnus/gnus-kill.el (gnus-apply-kill-file-internal): * lisp/gnus/gnus-range.el (gnus-range-difference) (gnus-sorted-range-intersection, gnus-uncompress-range) (gnus-add-to-range, gnus-remove-from-range) (gnus-member-of-range, gnus-list-range-intersection) (gnus-list-range-difference, gnus-range-length, gnus-range-add) (gnus-range-map): Make into obsolete aliases. * lisp/gnus/gnus-start.el (gnus-make-articles-unread): (gnus-convert-old-ticks): (gnus-read-old-newsrc-el-file): * lisp/gnus/gnus-sum.el (gnus-select-newsgroup): (gnus-articles-to-read): (gnus-articles-to-read): (gnus-killed-articles): (gnus-adjust-marked-articles): (gnus-update-marks): (gnus-update-marks): (gnus-compute-read-articles): (gnus-list-of-read-articles): (gnus-summary-update-info): (gnus-summary-move-article): (gnus-summary-expire-articles): (gnus-update-read-articles): (gnus-summary-insert-old-articles): (gnus-summary-insert-old-articles): (gnus-summary-insert-old-articles): * lisp/gnus/mail-source.el (gnus-range): (gnus-compress-sequence): * lisp/gnus/nnheader.el (range): (gnus-range-add): (nnheader-update-marks-actions): * lisp/gnus/nnimap.el (nnimap-update-info): (nnimap-update-info): (nnimap-update-info): (nnimap-update-qresync-info): (nnimap-update-qresync-info): (nnimap-update-qresync-info): (nnimap-parse-copied-articles): * lisp/gnus/nnmaildir.el (nnmaildir-request-update-info): (nnmaildir-request-update-info): (nnmaildir-request-expire-articles): (nnmaildir-request-expire-articles): (nnmaildir-request-set-mark): * lisp/gnus/nnmairix.el (nnmairix-request-set-mark): * lisp/gnus/nnmbox.el (nnmbox-record-active-article): (nnmbox-record-deleted-article): * lisp/gnus/nnml.el (nnml-request-compact-group): * lisp/gnus/nnvirtual.el (nnvirtual-request-expire-articles): * lisp/gnus/nnselect.el (numbers-by-group): (nnselect-request-update-info): (nnselect-push-info):
Diffstat (limited to 'test')
-rw-r--r--test/lisp/emacs-lisp/range-tests.el65
1 files changed, 65 insertions, 0 deletions
diff --git a/test/lisp/emacs-lisp/range-tests.el b/test/lisp/emacs-lisp/range-tests.el
new file mode 100644
index 00000000000..d3abbf9da31
--- /dev/null
+++ b/test/lisp/emacs-lisp/range-tests.el
@@ -0,0 +1,65 @@
1;;; range-tests.el --- Tests for range.el -*- lexical-binding: t; -*-
2
3;; Copyright (C) 2021 Free Software Foundation, Inc.
4
5;; This file is part of GNU Emacs.
6
7;; GNU Emacs is free software: you can redistribute it and/or modify
8;; it under the terms of the GNU General Public License as published by
9;; the Free Software Foundation, either version 3 of the License, or
10;; (at your option) any later version.
11
12;; GNU Emacs is distributed in the hope that it will be useful,
13;; but WITHOUT ANY WARRANTY; without even the implied warranty of
14;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15;; GNU General Public License for more details.
16
17;; You should have received a copy of the GNU General Public License
18;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
19
20;;; Commentary:
21
22;;
23
24;;; Code:
25
26(require 'range)
27(require 'ert)
28(require 'ert-x)
29
30(ert-deftest ranges ()
31 (should (equal (range-compress-list '(2 3 4 5 9 11 12 13))
32 '((2 . 5) 9 (11 . 13))))
33 (should (equal (range-uncompress '((2 . 5) 9 (11 . 13)))
34 '(2 3 4 5 9 11 12 13)))
35 (should (equal (range-normalize '(1 . 2))
36 '((1 . 2))))
37 (should (equal (range-difference '((1 . 10))
38 '((2 . 7)))
39 '(1 (8 . 10))))
40 (should (equal (range-intersection '((2 . 5) 9 (11 . 13))
41 '((5 . 12)))
42 '(5 9 (11 . 12))))
43 (should (equal (range-add-list '((2 . 5) 9 (11 . 13))
44 '(10 11 12 15 16 17))
45 '((2 . 5) (9 . 10) (11 . 13) (15 . 17))))
46 (should (equal (range-remove (copy-tree '((2 . 5) 9 (11 . 13)))
47 '((5 . 9)))
48 '((2 . 4) (11 . 13))))
49 (should (range-member-p 9 '((2 . 5) 9 (11 . 13))))
50 (should (range-member-p 12 '((2 . 5) 9 (11 . 13))))
51 (should (equal (range-list-intersection
52 '(4 5 6 7 8 9)
53 '((2 . 5) 9 (11 . 13)))
54 '(4 5 9)))
55 (should (equal (range-list-difference
56 '(4 5 6 7 8 9)
57 '((2 . 5) 9 (11 . 13)))
58 '(6 7 8)))
59 (should (equal (range-length '((2 . 5) 9 (11 . 13)))
60 8))
61 (should (equal (range-concat '((2 . 5) 9 (11 . 13))
62 '(6 (12 . 15)))
63 '((2 . 6) 9 (11 . 15)))))
64
65;;; range-tests.el ends here