Kaynağa Gözat

org-protocol: Fix URL handling -- add tests

* testing/lisp/test-org-protocol.el (test-org-protocol/org-protocol-parse-parameters):
  Add test for the commit e0bfdec22 which un-escape extracted link as
  it is url-encoded externally.
Pierre Téchoueyres 6 yıl önce
ebeveyn
işleme
2216f4d2c7
1 değiştirilmiş dosya ile 10 ekleme ve 0 silme
  1. 10 0
      testing/lisp/test-org-protocol.el

+ 10 - 0
testing/lisp/test-org-protocol.el

@@ -35,6 +35,16 @@
   (let ((data (org-protocol-parse-parameters "url=abc&title=def" t)))
     (should (string= (plist-get data :url) "abc"))
     (should (string= (plist-get data :title) "def")))
+  ;; Parse new-style complex links
+  (let* ((url (concat "template=p&"
+		      "url=https%3A%2F%2Forgmode.org%2Forg.html%23capture-protocol&"
+		      "title=The%20Org%20Manual&"
+		      "body=9.4.2%20capture%20protocol"))
+	 (data (org-protocol-parse-parameters url)))
+    (should (string= (plist-get data :template) "p"))
+    (should (string= (plist-get data :url) "https://orgmode.org/org.html#capture-protocol"))
+    (should (string= (plist-get data :title) "The Org Manual"))
+    (should (string= (plist-get data :body) "9.4.2 capture protocol")))
   ;; Parse old-style links
   (let ((data (org-protocol-parse-parameters "abc/def" nil '(:url :title))))
     (should (string= (plist-get data :url) "abc"))