[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/hyperbole ff41854 4/4: Merge branch 'master' of hyperbo
From: |
ELPA Syncer |
Subject: |
[elpa] externals/hyperbole ff41854 4/4: Merge branch 'master' of hyperbole |
Date: |
Sat, 29 May 2021 12:57:11 -0400 (EDT) |
branch: externals/hyperbole
commit ff41854887e1cd59dc392010ae565bb7c5dfed03
Merge: 3541e4a b11bd83
Author: Bob Weiner <rsw@gnu.org>
Commit: Bob Weiner <rsw@gnu.org>
Merge branch 'master' of hyperbole
---
ChangeLog | 6 ++++++
test/hui-tests.el | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 68 insertions(+)
diff --git a/ChangeLog b/ChangeLog
index 0186a9d..da77abc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2021-05-29 Mats Lidell <matsl@gnu.org>
+
+* test/hui-tests.el (hui-ebut-create-link-to-directory)
+ (hui-ebut-use-region-as-label, hui-ebut-www-link)
+ (hui-ebut-create-exec-shell-cmd): ebut create tests.
+
2021-05-27 Bob Weiner <rsw@gnu.org>
* hpath.el (hpath:expand-with-variable): Fix to not add variable
diff --git a/test/hui-tests.el b/test/hui-tests.el
index 29c70c1..c513e93 100644
--- a/test/hui-tests.el
+++ b/test/hui-tests.el
@@ -18,6 +18,12 @@
(require 'ert)
(require 'with-simulated-input)
+(load (expand-file-name "hy-test-helpers"
+ (file-name-directory (or load-file-name
+ default-directory))))
+(declare-function hy-test-helpers:consume-input-events "hy-test-helpers")
+
+
(ert-deftest hui-ibut-label-create ()
"Create a label for an implicit button."
(with-temp-buffer
@@ -40,5 +46,61 @@
(should (equal (car err) 'error))
(should (string-match "ibutton at point already has a label" (cadr
err)))))))))
+(ert-deftest hui-ebut-create-link-to-directory ()
+ "Create an ebut with link-to-directory."
+ (skip-unless (not noninteractive))
+ (let ((file (make-temp-file "hypb_" nil ".txt")))
+ (unwind-protect
+ (progn
+ (find-file file)
+ (should (hact 'kbd-key "C-h h e c label RET RET link-to-directory
RET RET"))
+ (hy-test-helpers:consume-input-events)
+ (should (eq (hattr:get (hbut:at-p) 'actype)
'actypes::link-to-directory))
+ (should (equal (hattr:get (hbut:at-p) 'lbl-key) "label")))
+ (delete-file file))))
+
+(ert-deftest hui-ebut-use-region-as-label ()
+ "Create an ebut using region as label."
+ (skip-unless (not noninteractive))
+ (let ((file (make-temp-file "hypb_" nil ".txt" "label")))
+ (unwind-protect
+ (progn
+ (find-file file)
+ (beginning-of-buffer)
+ (mark-word)
+ (should (hact 'kbd-key "C-h h e c RET link-to-directory RET RET"))
+ (hy-test-helpers:consume-input-events)
+ (should (eq (hattr:get (hbut:at-p) 'actype)
'actypes::link-to-directory))
+ (should (equal (hattr:get (hbut:at-p) 'lbl-key) "label")))
+ (delete-file file))))
+
+(ert-deftest hui-ebut-www-link ()
+ "Create an ebut with an url."
+ (skip-unless (not noninteractive))
+ (let ((file (make-temp-file "hypb_" nil ".txt")))
+ (unwind-protect
+ (progn
+ (find-file file)
+ (should (hact 'kbd-key "C-h h e c label RET RET www-url RET
www.example.com RET"))
+ (hy-test-helpers:consume-input-events)
+ (should (eq (hattr:get (hbut:at-p) 'actype) 'actypes::www-url))
+ (should (equal (hattr:get (hbut:at-p) 'args) '("www.example.com")))
+ (should (equal (hattr:get (hbut:at-p) 'lbl-key) "label")))
+ (delete-file file))))
+
+(ert-deftest hui-ebut-create-exec-shell-cmd ()
+ "Create an ebut that executes a command."
+ (skip-unless (not noninteractive))
+ (let ((file (make-temp-file "hypb_" nil ".txt")))
+ (unwind-protect
+ (progn
+ (find-file file)
+ (should (hact 'kbd-key "C-h h e c label RET RET exec-shell-cmd RET
ls SPC /tmp RET y RET"))
+ (hy-test-helpers:consume-input-events)
+ (should (eq (hattr:get (hbut:at-p) 'actype)
'actypes::exec-shell-cmd))
+ (should (equal (hattr:get (hbut:at-p) 'args) '("ls /tmp" t nil)))
+ (should (equal (hattr:get (hbut:at-p) 'lbl-key) "label")))
+ (delete-file file))))
+
(provide 'hui-tests)
;;; hui-tests.el ends here