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

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

[elpa] externals/hyperbole c8947dd 47/50: Merge branch 'master' of hyper


From: Stefan Monnier
Subject: [elpa] externals/hyperbole c8947dd 47/50: Merge branch 'master' of hyperbole
Date: Wed, 17 Mar 2021 18:44:23 -0400 (EDT)

branch: externals/hyperbole
commit c8947dd88f916f324aa6e8bfacc3ef69c0db9e7d
Merge: c7d62e1 9ca5b0f
Author: Bob Weiner <rsw@gnu.org>
Commit: Bob Weiner <rsw@gnu.org>

    Merge branch 'master' of hyperbole
---
 Changes                      | 18 ++++++++++
 test/hbut-tests.el           | 82 ++++++++++++++++++++++++++++++++------------
 test/hy-test-dependencies.el |  3 +-
 3 files changed, 81 insertions(+), 22 deletions(-)

diff --git a/Changes b/Changes
index afe08f7..18a88d6 100644
--- a/Changes
+++ b/Changes
@@ -1,8 +1,26 @@
+2021-03-14  Mats Lidell  <matsl@gnu.org>
+
+* test/hbut-tests.el (hbut-ib-link-to-file-with-label-variants): Test
+    variants of label separation chars and lengths
+    (hbut-ib-create-label): Test creation of label
+    (hbut-ib-create-label-fails-if-label-exists): Check creation fails
+    when label exists
+
+* test/hy-test-dependencies.el (package-installed-p): Add
+    with-simulated-input
+
 2021-03-13  Bob Weiner  <rsw@gnu.org>
 
 * hbut.el (defil): Improved to handle both symbol and string representations
     of Hyperbole action types.
 
+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..4730fc5 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,51 @@
         (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-link-to-file-with-label-variants ()
+  (cl-loop for ch in '(?: ?- ?=) do
+           (cl-loop for n from 0 to 3 do
+                    (with-temp-buffer
+                      (insert "<[demo]>" (make-string n ch) " 
\"${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))))
+
+(ert-deftest hbut-ib-create-label ()
+  "Create a label for an implicit button"
+  (with-temp-buffer
+    (insert "\"/tmp\"\n")
+    (goto-char 3)
+    (with-simulated-input "TMP RET"
+      (hui:ibut-label-create)
+      (should (string= "<[TMP]> \"/tmp\"\n" (buffer-string))))))
+
+(ert-deftest hbut-ib-create-label-fails-if-label-exists ()
+  "Creation of a label for an implicit button fails if a label exists."
+  (with-temp-buffer
+    (insert "<[LBL]>: \"/tmp\"\n")
+    (goto-char 14)
+    (with-simulated-input "TMP RET"
+      (condition-case err
+          (hui:ibut-label-create)
+        (error
+         (progn
+           (should (equal (car err) 'error))
+           (should (string-search "ibutton at point already has a label" (cadr 
err)))))))))
+
 (provide 'hbut-tests)
 ;;; hbut-tests.el ends here
diff --git a/test/hy-test-dependencies.el b/test/hy-test-dependencies.el
index e06f2ec..364f0c8 100644
--- a/test/hy-test-dependencies.el
+++ b/test/hy-test-dependencies.el
@@ -21,7 +21,8 @@
 (add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/";))
 (unless (package-installed-p 'el-mock)
   (package-refresh-contents)
-  (package-install 'el-mock))
+  (package-install 'el-mock)
+  (package-install 'with-simulated-input))
 
 (provide 'hy-test-dependencies)
 ;;; hy-test-dependencies.el ends here



reply via email to

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