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

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

[elpa] externals/hyperbole 590e361 1/2: Add gbut tests (#107)


From: ELPA Syncer
Subject: [elpa] externals/hyperbole 590e361 1/2: Add gbut tests (#107)
Date: Sun, 18 Jul 2021 17:57:13 -0400 (EDT)

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

    Add gbut tests (#107)
---
 ChangeLog          |  5 +++++
 test/hbut-tests.el | 28 ++++++++++++++++++++++++++++
 2 files changed, 33 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index c8f51b8..10714a4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2021-07-11  Mats Lidell  <matsl@gnu.org>
+
+* test/hbut-tests.el (gbut-program-calls-ebut-program)
+    (gbut-program-link-to-directory): Add gbut tests.
+
 2021-07-04  Mats Lidell  <matsl@gnu.org>
 
 * test/hui-tests.el (hui-ebut-create-link-to-www-url)
diff --git a/test/hbut-tests.el b/test/hbut-tests.el
index 396e9ac..1b53c9b 100644
--- a/test/hbut-tests.el
+++ b/test/hbut-tests.el
@@ -17,6 +17,8 @@
 
 (require 'ert)
 (require 'hbut)
+(require 'hactypes)
+(require 'el-mock)
 
 (ert-deftest ebut-program-link-to-directory ()
   "Programatically create ebut with link-to-directory."
@@ -69,5 +71,31 @@
             ))
       (delete-file file))))
 
+(ert-deftest gbut-program-calls-ebut-program ()
+  "Programatically create gbut calls ebut:program."
+  (let ((test-file (make-temp-file "test-file")))
+    (setq test-buffer (find-file-noselect test-file))
+    (unwind-protect
+        (with-mock
+          (mock (find-file-noselect (expand-file-name hbmap:filename 
hbmap:dir-user)) => test-buffer)
+          (mock (ebut:program "label" 'actypes::link-to-directory "/tmp") => t)
+          (gbut:ebut-program "label" 'actypes::link-to-directory "/tmp"))
+      (delete-file test-file))))
+
+(ert-deftest gbut-program-link-to-directory ()
+  "Programatically create gbut with link-to-directory."
+  (let ((test-file (make-temp-file "gbut" nil ".txt")))
+    (setq test-buffer (find-file-noselect test-file))
+    (unwind-protect
+       (progn
+          (with-mock
+            (mock (find-file-noselect (expand-file-name hbmap:filename 
hbmap:dir-user)) => test-buffer)
+            (gbut:ebut-program "global" 'actypes::link-to-directory "/tmp"))
+         (with-current-buffer test-buffer
+            (should (eq (hattr:get (hbut:at-p) 'actype) 
'actypes::link-to-directory))
+            (should (equal (hattr:get (hbut:at-p) 'args) '("/tmp")))
+            (should (equal (hattr:get (hbut:at-p) 'lbl-key) "global"))))
+      (delete-file test-file))))
+
 (provide 'hbut-tests)
 ;;; hbut-tests.el ends here



reply via email to

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