]> git.eshelyaron.com Git - emacs.git/commitdiff
Add test for add-to-ordered-list
authorLars Ingebrigtsen <larsi@gnus.org>
Thu, 31 Dec 2020 04:00:45 +0000 (05:00 +0100)
committerLars Ingebrigtsen <larsi@gnus.org>
Thu, 31 Dec 2020 04:00:45 +0000 (05:00 +0100)
test/lisp/subr-tests.el

index 25da19574a9071940a349b9d6c89fd1f3889d334..3154135ce17869eb044786f7a3f0e88b41fe10c2 100644 (file)
@@ -597,6 +597,22 @@ See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=19350."
     (undo-boundary)
     (undo)
     (should (equal (buffer-string) ""))))
+
+(defvar subr--ordered nil)
+
+(ert-deftest subr--add-to-ordered-list ()
+  (setq subr--ordered nil)
+  (add-to-ordered-list 'subr--ordered 'b 2)
+  (should (equal subr--ordered '(b)))
+  (add-to-ordered-list 'subr--ordered 'c 3)
+  (should (equal subr--ordered '(b c)))
+  (add-to-ordered-list 'subr--ordered 'a 1)
+  (should (equal subr--ordered '(a b c)))
+  (add-to-ordered-list 'subr--ordered 'e)
+  (should (equal subr--ordered '(a b c e)))
+  (add-to-ordered-list 'subr--ordered 'd 4)
+  (should (equal subr--ordered '(a b c d e))))
+
 \f
 ;;; Apropos.