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

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

[elpa] externals/hyperbole 1c21784 44/50: Add tests for ib with labels (


From: Stefan Monnier
Subject: [elpa] externals/hyperbole 1c21784 44/50: Add tests for ib with labels (#52)
Date: Wed, 17 Mar 2021 18:44:22 -0400 (EDT)

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

    Add tests for ib with labels (#52)
    
    Use test case for defal with function that is now fixed
    Add tests for ib with labels
---
 Changes            |  7 +++++++
 test/hbut-tests.el | 52 +++++++++++++++++++++++++++++++---------------------
 2 files changed, 38 insertions(+), 21 deletions(-)

diff --git a/Changes b/Changes
index efcdf96..c665194 100644
--- a/Changes
+++ b/Changes
@@ -1,3 +1,10 @@
+2021-03-12  Mats Lidell  <matsl@gnu.org>
+
+* test/hbut-tests.el (hbut-verify-defal, hbut-defal-function): Test defal
+    with function.
+    (hbut-ib-link-to-file-with-label, hbut-ib-url-with-label): Test for
+    implicit buttons with labels.
+
 2021-03-11  Bob Weiner  <rsw@gnu.org>
 
 * hbut.el (defil, defal): If LINK-EXPR is a function and the button is
diff --git a/test/hbut-tests.el b/test/hbut-tests.el
index 1da63c3..ab7c663 100644
--- a/test/hbut-tests.el
+++ b/test/hbut-tests.el
@@ -63,27 +63,21 @@
         (should (looking-at "emacs-version")))
     (ibtype:delete 'ibtypes::defal-key)))
 
-
-;; This test seems to break the ert tests when rerun in the same emacs
-;; process so commenting out for now. As defined now it is an expected
-;; failure anyway.
-;;
-;; (defun hbut-verify-defal (x)
-;;   "Verify function i called with X set to the string `test'."
-;;   (should (string= x "test")))
-;;
-;; (ert-deftest hbut-defal-function ()
-;;   "defal call function should only supply the argument portion of
-;; the button text?"
-;;   :expected-result :failed
-;;   (defal defal-func 'hbut-verify-defal)
-;;   (unwind-protect
-;;       (with-temp-buffer
-;;         (insert "<defal-func test>")
-;;         (goto-char 4)
-;;         (action-key)))
-;;     (progn
-;;       (ibtype:delete 'ibtypes::defal-func)))
+(defun hbut-verify-defal (x)
+  "Verify function i called with X set to the string `test'."
+  (should (string= x "test")))
+
+(ert-deftest hbut-defal-function ()
+  "defal call function should only supply the argument portion of
+the button text"
+  (defal defal-func 'hbut-verify-defal)
+  (unwind-protect
+      (with-temp-buffer
+        (insert "<defal-func test>")
+        (goto-char 4)
+        (action-key)))
+    (progn
+      (ibtype:delete 'ibtypes::defal-func)))
   
 (ert-deftest hbut-defal-fails-on-file-missing ()
   (defal defal-path-missing "${hyperb:dir}/\\1")
@@ -144,5 +138,21 @@
         (should (looking-at "emacs-version")))
     (ibtype:delete 'ibtypes::defil-key)))
 
+;; Labels
+(ert-deftest hbut-ib-link-to-file-with-label ()
+  (with-temp-buffer
+    (insert "<[emacs]>: \"${hyperb:dir}/DEMO\"")
+    (goto-char 4)
+    (hy-test-helpers:action-key-should-call-hpath:find (concat hyperb:dir 
"DEMO"))))
+
+(ert-deftest hbut-ib-url-with-label ()
+  "Should find link but fails with (user-error \"No link found\")"
+  :expected-result :failed
+  (with-temp-buffer
+    (insert "<[PR34]>: \"https://github.com/rswgnu/hyperbole/pull/34\"";)
+    (goto-char 4)
+    (let ((browse-url-browser-function 'hbut-defal-url))
+      (action-key))))
+
 (provide 'hbut-tests)
 ;;; hbut-tests.el ends here



reply via email to

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