emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/hyperbole 6e43d2d01f: Add hyrolo sort test (#139)


From: ELPA Syncer
Subject: [elpa] externals/hyperbole 6e43d2d01f: Add hyrolo sort test (#139)
Date: Thu, 30 Dec 2021 07:57:31 -0500 (EST)

branch: externals/hyperbole
commit 6e43d2d01fe937ec3c26ba2f994df0395ae1312d
Author: Mats Lidell <mats.lidell@lidells.se>
Commit: GitHub <noreply@github.com>

    Add hyrolo sort test (#139)
---
 ChangeLog            |  4 ++++
 test/hyrolo-tests.el | 31 +++++++++++++++++++++++++++++++
 2 files changed, 35 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 90860e449f..2c7cb9f9f8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2021-12-30  Mats Lidell  <matsl@gnu.org>
+
+* test/hyrolo-tests.el (hyrolo-sort-test): Add hyrolo sort test.
+
 2021-12-29  Mats Lidell  <matsl@gnu.org>
 
 * test/hmouse-info-tests.el (hmouse-info-read-index-with-completion)
diff --git a/test/hyrolo-tests.el b/test/hyrolo-tests.el
index 35d31816f0..915ca71a07 100644
--- a/test/hyrolo-tests.el
+++ b/test/hyrolo-tests.el
@@ -181,5 +181,36 @@
              (should (string-match "No following same-level heading" (cadr 
err)))))))
     (hyrolo-demo-quit)))
 
+(ert-deftest hyrolo-sort-test ()
+  "Rolo files can be sorted."
+  (let ((hyrolo-file (make-temp-file "hypb" nil ".otl")))
+    (unwind-protect
+        (let ((hyrolo-file-list (list hyrolo-file)))
+          (find-file hyrolo-file)
+          (insert "===\nHdr\n===\n")
+          (goto-char (point-min))
+          (should (looking-at "==="))
+          (hyrolo-add "c")
+          (hyrolo-add "b")
+          (hyrolo-add "a")
+          (hyrolo-add "b/d")
+
+          ; Verify insertion order and following date on separate line
+          (goto-char (point-min))
+          (should (looking-at "==="))
+          (dolist (insertion-order '("c" "b" "d" "a"))
+            (goto-char (1+ (should (search-forward insertion-order))))
+            (should (looking-at-p "^\t[0-9/]+$")))
+
+          (hyrolo-sort)
+
+          ; Verify sorted order and following date on separate line
+          (goto-char (point-min))
+          (should (looking-at "==="))
+          (dolist (sorted-order '("a" "b" "d" "c"))
+            (goto-char (1+ (should (search-forward sorted-order))))
+            (should (looking-at-p "^\t[0-9/]+$"))))
+      (delete-file hyrolo-file))))
+
 (provide 'hyrolo-tests)
 ;;; hyrolo-tests.el ends here



reply via email to

[Prev in Thread] Current Thread [Next in Thread]