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

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

[nongnu] elpa/hyperdrive 68e55a0ab6 55/82: Test: Add hyperdrive-test-org


From: ELPA Syncer
Subject: [nongnu] elpa/hyperdrive 68e55a0ab6 55/82: Test: Add hyperdrive-test-org-store-link-scenarios
Date: Mon, 25 Sep 2023 19:00:54 -0400 (EDT)

branch: elpa/hyperdrive
commit 68e55a0ab6831ff0e179c335a2588ab7a4e09a3f
Author: Joseph Turner <joseph@ushin.org>
Commit: Joseph Turner <joseph@ushin.org>

    Test: Add hyperdrive-test-org-store-link-scenarios
---
 tests/test-hyperdrive-org-link.el | 35 ++++++++++++++++++++++++++++-------
 1 file changed, 28 insertions(+), 7 deletions(-)

diff --git a/tests/test-hyperdrive-org-link.el 
b/tests/test-hyperdrive-org-link.el
index f8df7f3089..c068a1591f 100644
--- a/tests/test-hyperdrive-org-link.el
+++ b/tests/test-hyperdrive-org-link.el
@@ -81,6 +81,25 @@
 
 ;;;; Tests
 
+;;;;; Scenarios
+
+(defvar hyperdrive-test-org-store-link-scenarios
+  '((org-mode/before-heading
+     :public-key "deadbeef"
+     :path "/foo/bar quux.org"
+     :content "★
+* Heading A"
+     :url "hyper://deadbeef/foo/bar%20quux.org"
+     :desc nil))
+  "Alist keyed by scenario symbols.
+Each value is a plist with the following keys:
+
+- \\=`:public-key'
+- \\=`:path'
+- \\=`:content'
+- \\=`:url'
+- \\=`:desc'")
+
 ;;;;; Storing links
 
 (cl-defun hyperdrive-test-org-store-link (contents &key public-key path)
@@ -104,13 +123,15 @@ Point is indicated by ★."
     org-stored-links))
 
 (ert-deftest hyperdrive-test-org-link-store/before-heading ()
-  (cl-destructuring-bind ((url desc))
-      (hyperdrive-test-org-store-link
-        "★
-* Heading A"
-        :public-key "deadbeef" :path "/foo/bar quux.org")
-    (should (string= "hyper://deadbeef/foo/bar%20quux.org" url))
-    (should (null desc))))
+  (pcase-let* (((map :public-key :path :content
+                     (:url expected-url) (:desc expected-desc))
+                (alist-get 'org-mode/before-heading
+                           hyperdrive-test-org-store-link-scenarios))
+               (`((,got-url ,got-desc))
+                (hyperdrive-test-org-store-link content
+                  :public-key public-key :path path)))
+    (should (string= expected-url got-url))
+    (should (string= expected-desc got-desc))))
 
 (ert-deftest hyperdrive-test-org-link-store/on-heading-with-custom-id ()
   (cl-destructuring-bind ((url desc))



reply via email to

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