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

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

[elpa] externals/hyperbole a968d15edb 4/5: Merge branch 'master' into rs


From: ELPA Syncer
Subject: [elpa] externals/hyperbole a968d15edb 4/5: Merge branch 'master' into rsw
Date: Sat, 17 Aug 2024 18:58:14 -0400 (EDT)

branch: externals/hyperbole
commit a968d15edbab2b07c380480b05c84b9f82e42911
Merge: b19308fae2 4a30aab3b7
Author: bw <rsw@gnu.org>
Commit: bw <rsw@gnu.org>

    Merge branch 'master' into rsw
---
 ChangeLog            |  7 ++++++
 FAST-DEMO            |  2 +-
 test/hywiki-tests.el | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++-
 3 files changed, 73 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 2e65c65b18..3b682e3b32 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -25,6 +25,13 @@
           (hbut:map-type): Create and use old logic from 'hbut:map' and
     use in 'ebut:map', 'ibut:map' and 'ibut:label-map'.
 
+2024-08-15  Mats Lidell  <matsl@gnu.org>
+
+* test/hywiki-tests.el (hywiki-tests--org-set-publish-project)
+    (hywiki-tests--org-get-publish-project)
+    (hywiki-tests--org-link-resolve)
+    (hywiki-tests--org-link-export): Add publish and export tests.
+
 2024-08-15  Bob Weiner  <rsw@gnu.org>
 
 * hui.el (hbut:alist, hbut:list): Add to match but type-specific functions.
diff --git a/FAST-DEMO b/FAST-DEMO
index fda71bc84b..c519a6ddcb 100644
--- a/FAST-DEMO
+++ b/FAST-DEMO
@@ -73,7 +73,7 @@
   
|-----------------------------------------------------+------------------------------|
   | <[HyControl, fast Emacs frame and window manager]>  | 
https://youtu.be/M3-aMh1ccJk |
   
|-----------------------------------------------------+------------------------------|
-  | <[Writing test cases for GNU Hyperbole]>            | 
https:/youtu.be/maNQSKxXIzI  |
+  | <[Writing test cases for GNU Hyperbole]>            | 
https://youtu.be/maNQSKxXIzI |
   
|-----------------------------------------------------+------------------------------|
   | <[Find/Web Search]>                                 | 
https://youtu.be/8lMlJed0-OM |
   
|-----------------------------------------------------+------------------------------|
diff --git a/test/hywiki-tests.el b/test/hywiki-tests.el
index 9fe3fdab24..a200ee0463 100644
--- a/test/hywiki-tests.el
+++ b/test/hywiki-tests.el
@@ -3,7 +3,7 @@
 ;; Author:       Mats Lidell
 ;;
 ;; Orig-Date:    18-May-24 at 23:59:48
-;; Last-Mod:     14-Aug-24 at 01:53:15 by Bob Weiner
+;; Last-Mod:     15-Aug-24 at 09:17:01 by Mats Lidell
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -21,6 +21,7 @@
 (require 'el-mock)
 (require 'hy-test-helpers)
 (require 'hywiki)
+(require 'ox-publish)
 
 (ert-deftest hywiki-tests--hywiki-add-page--adds-file-in-wiki-folder ()
   "Verify add page creates file in wiki folder and sets hash table."
@@ -280,5 +281,68 @@
     (mocklet ((buffer-name => "*Other Tags*"))
       (should-not (hywiki-at-tags-p)))))
 
+(ert-deftest hywiki-tests--org-set-publish-project ()
+  "Verify `hywiki-org-set-publish-project' sets publish vars with hywiki."
+  (let (hywiki-org-publish-project-alist
+        org-publish-project-alist)
+    (should (hywiki-org-set-publish-project))
+    (should (assoc "hywiki" org-publish-project-alist))
+    (should (string= "hywiki" (car hywiki-org-publish-project-alist)))))
+
+(ert-deftest hywiki-tests--org-get-publish-project ()
+  "Verify `hywiki-org-get-publish-project' gets project or creates one if not 
found."
+  ;; Gets project that exists
+  (let ((org-publish-project-alist '(("hywiki"))) ; hywiki exists
+        (hywiki-org-publish-project-alist 'var-has-a-value))
+    (should (equal '("hywiki") (hywiki-org-get-publish-project))))
+  ;; Created project if not exists
+  (let (org-publish-project-alist)      ; hywiki does not exist
+    (mocklet (((hywiki-org-set-publish-project) => '("project")))
+      (should (equal '("project") (hywiki-org-get-publish-project))))))
+
+(ert-deftest hywiki-tests--org-link-resolve ()
+  "Verify `hywiki-org-link-resolve' resolves a link to page."
+  (should-not (hywiki-org-link-resolve 88)) ; Number
+  (should-not (hywiki-org-link-resolve '("string"))) ; List
+  (let* ((hywiki-directory (make-temp-file "hywiki" t))
+         (wikipage (hywiki-add-page "WikiWord")))
+    (unwind-protect
+        (progn
+          (should-not (hywiki-org-link-resolve "NoWikiWord"))
+          (should (string= wikipage (hywiki-org-link-resolve "WikiWord")))
+          (should (string= wikipage (hywiki-org-link-resolve "hy:WikiWord")))
+          (should (string= (concat wikipage "::section") 
(hywiki-org-link-resolve "WikiWord#section"))))
+      (hy-delete-file-and-buffer wikipage)
+      (hy-delete-dir-and-buffer hywiki-directory))))
+
+(ert-deftest hywiki-tests--org-link-export ()
+  "Verify `hywiki-org-link-export' output for different formats."
+  (let* ((hywiki-directory (make-temp-file "hywiki" t))
+         (wikipage (hywiki-add-page "WikiWord")))
+    (unwind-protect
+        (progn
+          (should (string-match-p
+                   (format "\\[hy\\] <doc:.*%s>" wikipage)
+                   (hywiki-org-link-export "WikiWord" "doc" 'ascii)))
+          (should (string-match-p
+                   (format "<a href=\".*%s\">doc</a>"
+                           (replace-regexp-in-string "\\.org" ".html" 
wikipage))
+                   (hywiki-org-link-export "WikiWord" "doc" 'html)))
+          (should (string-match-p
+                   (format "\\[doc\\](.*%s)" wikipage)
+                   (hywiki-org-link-export "WikiWord" "doc" 'md)))
+          (should (string-match-p
+                   (format "\\href{.*%s}{doc}" wikipage)
+                   (hywiki-org-link-export "WikiWord" "doc" 'latex)))
+          (should (string-match-p
+                   (format "@uref{.*%s,doc}" wikipage)
+                   (hywiki-org-link-export "WikiWord" "doc" 'texinfo)))
+          (should (string-match-p
+                   (format ".*%s" wikipage)
+                   (hywiki-org-link-export "WikiWord" "doc" 'unknown)))
+          (should (string= "NotAWikiPage" (hywiki-org-link-export 
"NotAWikiPage" "doc" 'ascii))))
+      (hy-delete-file-and-buffer wikipage)
+      (hy-delete-dir-and-buffer hywiki-directory))))
+
 (provide 'hywiki-tests)
 ;;; hywiki-tests.el ends here



reply via email to

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