[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/hyperbole d91d546 6/6: Merge branch 'master' of hyperbo
From: |
ELPA Syncer |
Subject: |
[elpa] externals/hyperbole d91d546 6/6: Merge branch 'master' of hyperbole |
Date: |
Mon, 19 Apr 2021 00:57:09 -0400 (EDT) |
branch: externals/hyperbole
commit d91d5465f0f470d8d3aabf2c9bb389571673ee23
Merge: c5dbb88 a0be037
Author: Bob Weiner <rsw@gnu.org>
Commit: Bob Weiner <rsw@gnu.org>
Merge branch 'master' of hyperbole
---
Changes | 46 +++++++-
Makefile | 4 +-
test/demo-tests.el | 3 +-
test/hbut-tests.el | 281 ++++++++++++++++++++++++++++++++++++++++++++++++-
test/hibtypes-tests.el | 17 ++-
test/hpath-tests.el | 14 +++
test/hui-tests.el | 44 ++++++++
7 files changed, 396 insertions(+), 13 deletions(-)
diff --git a/Changes b/Changes
index cf21e2a..f45045c 100644
--- a/Changes
+++ b/Changes
@@ -1,4 +1,40 @@
-2021-04-19 Bob Weiner <rsw@gnu.org>
+2021-04-18 Mats Lidell <matsl@gnu.org>
+
+* test/hibtypes-tests.el (ibtypes::pathname-with-dash-loads-file-test):
+ Bug fixed - Removed expected failed.
+
+* test/hbut-tests.el (hbut-pathname-with-dash-loads-file-test): Remove
+ expected fail and added check for file loading
+
+* test/hbut-tests.el (hbut-mail-address-test, hbut-pathname-test)
+ (hbut-pathname-lisp-variable-test, hbut-pathname-env-variable-test)
+ (hbut-pathname-emacs-lisp-file-test, hbut-pathname-anchor-test)
+ (hbut-pathname-anchor-line-test, hbut-pathname-line-column-test)
+ (hbut-pathname-load-path-line-column-test)
+ (hbut-pathname-with-dash-loads-file-test, hbut-pathname-directory-test)
+ (hbut-pathname-dot-slash-in-other-folder-should-fail-test)
+ (hbut-annot-bib-test, hbut-ctags-vgrind-test, ibtypes::etags-test)
+ (hbut-text-toc-test, hbut-dir-summary-test, hbut-rfc-test)
+ (hbut-man-apropos-test, hbut-info-node-test): ibtypes test cases
+ converted to use action-key
+
+* test/hibtypes-tests.el (ibtypes::pathname-path-variable-test): Ert test
+ for path variables.
+
+* test/hpath-tests.el (hpath:path-at-point-in-path-variable-test)
+
(hpath:path-at-point-in-path-variable-shorter-than-three-colons-returns-nil-test):
+ Ert test for path variables.
+
+* test/hbut-tests.el (hbut-pathname-path-variable-test)
+ (hbut-pathname-path-variable-with-two-colons-is-one-file-test)
+ (hbut-pathname-path-variable-with-three-colons-is-a-path-test)
+ (hbut-pathname-path-variable-with-short-first-elemet-is-tramp-url-test):
+ Test for path variables.
+
+* Makefile (ELC_KOTL): Add kotl/kprop-em.elc
+ (ELC_COMPILE): Remove kprop-em.elc
+
+2021-04-18 Bob Weiner <rsw@gnu.org>
* README.md, README.md.html, INSTALL: Update Hyperbole activation instruction
to use
(hyperbole-mode 1).
@@ -7,8 +43,6 @@
filenames; validate elsewhere. This resolves improper replication of final
part of a path, e.g. file/file.
-2021-04-18 Bob Weiner <rsw@gnu.org>
-
* kotl/MANIFEST: Add kotl-orgtbl.el and add copyright and documentation to
that file.
* hui-window.el (hmouse-alist): Move minibuffer click handler to after drags
so can drag
@@ -47,6 +81,12 @@
* test/hbut-tests.el (hbut-ib-url-with-label): Bug solved - removed
expected failed.
+* test/hui-tests.el (hui-ibut-label-create)
+(hui-ibut-label-create-fails-if-label-exists): Test for hui.el
+
+* test/hbut-tests.el (hbut-ib-create-label)
+(hbut-ib-create-label-fails-if-label-exists): Moved to hui-tests.el
+
2021-04-17 Bob Weiner <rsw@gnu.org>
* hpath.el (hpath:path-variable-regexp, hpath:choose-from-path-variable): Add.
diff --git a/Makefile b/Makefile
index 97bb5df..5a1e4fa 100644
--- a/Makefile
+++ b/Makefile
@@ -175,11 +175,11 @@ ELC_COMPILE = hactypes.elc hibtypes.elc hib-debbugs.elc
hib-doc-id.elc hib-kbd.
hycontrol.elc hui-jmenu.elc hui-menu.elc hui-mini.elc
hui-mouse.elc hui-select.elc \
hui-treemacs.elc hui-window.elc hui.elc hvar.elc hversion.elc
hvm.elc hypb.elc hyperbole.elc \
hyrolo-demo.elc hyrolo-logic.elc hyrolo-menu.elc hyrolo.elc
hywconfig.elc \
- set.elc kprop-em.elc hypb-ert.elc
+ set.elc hypb-ert.elc
ELC_KOTL = kotl/kexport.elc kotl/kfile.elc kotl/kfill.elc kotl/kimport.elc
kotl/klabel.elc \
kotl/klink.elc kotl/kmenu.elc kotl/knode.elc kotl/kotl-mode.elc
kotl/kotl-orgtbl.elc \
- kotl/kcell.elc kotl/kproperty.elc \
+ kotl/kcell.elc kotl/kproperty.elc kotl/kprop-em.elc \
kotl/kview.elc kotl/kvspec.elc
HY-TALK = HY-TALK/.hypb HY-TALK/HYPB HY-TALK/HY-TALK.org
diff --git a/test/demo-tests.el b/test/demo-tests.el
index 2db85d1..475fa6c 100644
--- a/test/demo-tests.el
+++ b/test/demo-tests.el
@@ -239,7 +239,8 @@
;; org
(ert-deftest demo-org-hide-header-test ()
- "Should work with action-key but does not. Works with org modes hide
function."
+ "Hide org mode header.
+Bug: Should work with action-key but does not. Works with org mode's hide
function."
:expected-result :failed
(with-temp-buffer
(org-mode)
diff --git a/test/hbut-tests.el b/test/hbut-tests.el
index f688029..22d5cfb 100644
--- a/test/hbut-tests.el
+++ b/test/hbut-tests.el
@@ -11,12 +11,13 @@
;;; Commentary:
-;; Runs unit tests on some of the examples given in the DEMO file.
+;; Runs tests that are based on using the action-key.
;;; Code:
(require 'ert)
(require 'hbut)
+(require 'el-mock)
(load (expand-file-name "hy-test-helpers"
(file-name-directory (or load-file-name
@@ -51,7 +52,7 @@
(ibtype:delete 'ibtypes::defal-url)))
(ert-deftest hbut-defal-url-%s ()
- "defal supports %s in LINK-EXPR."
+ "Use defal with %s in LINK-EXPR."
(defal defal-url "https://github.com/rswgnu/hyperbole/pull/%s")
(unwind-protect
(with-temp-buffer
@@ -79,8 +80,7 @@
(should (string= x "test")))
(ert-deftest hbut-defal-function ()
- "defal call function should only supply the argument portion of
-the button text"
+ "Use only the argument portion of the button text."
(defal defal-func 'hbut-verify-defal)
(unwind-protect
(with-temp-buffer
@@ -165,7 +165,7 @@ the button text"
(hy-test-helpers:action-key-should-call-hpath:find
(expand-file-name "DEMO" hyperb:dir))))))
(ert-deftest hbut-ib-url-with-label ()
- "Find link using label"
+ "Find link using label."
(with-temp-buffer
(insert "<[PR34]>: \"https://github.com/rswgnu/hyperbole/pull/34\"")
(goto-char 4)
@@ -194,5 +194,276 @@ the button text"
(should (equal (car err) 'error))
(should (string-search "ibutton at point already has a label" (cadr
err)))))))))
+(ert-deftest hbut-pathname-path-variable-test ()
+ "Find file in path variable."
+ (with-temp-buffer
+ (insert "\"/var/lib:/bar:/tmp:/foo\"")
+ (goto-char 16)
+ (hy-test-helpers:action-key-should-call-hpath:find "/tmp")))
+
+(ert-deftest hbut-pathname-path-variable-with-two-colons-is-one-file-test ()
+ "Path variable with two colons is not seen as a path variable."
+ (with-temp-buffer
+ (insert "\"/var/lib:/bar:/tmp\"")
+ (goto-char 16)
+ (hy-test-helpers:action-key-should-call-hpath:find "/var/lib:/bar:/tmp")))
+
+(ert-deftest hbut-pathname-path-variable-with-three-colons-is-a-path-test ()
+ "Path variable with three colons is not seen as a path variable."
+ (with-temp-buffer
+ (insert "\"/var/lib:/bar:/tmp:/foo\"")
+ (goto-char 16)
+ (hy-test-helpers:action-key-should-call-hpath:find "/tmp")))
+
+(ert-deftest
hbut-pathname-path-variable-with-short-first-elemet-is-tramp-url-test ()
+ "Path variable with three colons is a tramp url."
+ (with-temp-buffer
+ (insert "\"/var:/bar:/tmp:/foo\"")
+ (goto-char 14)
+ (hy-test-helpers:action-key-should-call-hpath:find "/anonymous@var:/bar")))
+
+;; Mail address
+(ert-deftest hbut-mail-address-test ()
+ "Open mail from mail address."
+ (unwind-protect
+ (with-temp-buffer
+ (insert "receiver@mail.org")
+ (goto-char 2)
+ (action-key)
+ (should (string= "*mail*" (buffer-name))))
+ (kill-buffer "*mail*")))
+
+;; Path name
+(ert-deftest hbut-pathname-test ()
+ (unwind-protect
+ (with-temp-buffer
+ (insert (format "\"%s\"" (expand-file-name "DEMO" hyperb:dir)))
+ (goto-char 2)
+ (action-key)
+ (should (string= "DEMO" (buffer-name))))
+ (kill-buffer "DEMO")))
+
+(ert-deftest hbut-pathname-lisp-variable-test ()
+ (unwind-protect
+ (with-temp-buffer
+ (insert "\"${hyperb:dir}/DEMO\"")
+ (goto-char 2)
+ (action-key)
+ (should (string= "DEMO" (buffer-name))))
+ (kill-buffer "DEMO")))
+
+(ert-deftest hbut-pathname-env-variable-test ()
+ (unwind-protect
+ (with-temp-buffer
+ (insert "\"${HOME}\"")
+ (goto-char 2)
+ (action-key)
+ (should (equal major-mode 'dired-mode))
+ (should (= 0 (string-match (getenv "HOME") (file-truename
default-directory)))))
+ nil))
+
+(ert-deftest hbut-pathname-emacs-lisp-file-test ()
+ (unwind-protect
+ (with-temp-buffer
+ (insert "\"hyperbole.el\"")
+ (goto-char 2)
+ (action-key)
+ (should (equal major-mode 'emacs-lisp-mode))
+ (should (buffer-file-name))
+ (should (string= "hyperbole.el" (buffer-name)))))
+ (kill-buffer "hyperbole.el"))
+
+(ert-deftest hbut-pathname-anchor-test ()
+ "Pathname with anchor."
+ (unwind-protect
+ (with-temp-buffer
+ (insert "\"${hyperb:dir}/DEMO#Smart Keys\"")
+ (goto-char 2)
+ (action-key)
+ (should (string= "DEMO" (buffer-name)))
+ (should (looking-at "\* Smart Keys")))
+ (kill-buffer "DEMO")))
+
+(ert-deftest hbut-pathname-anchor-line-test ()
+ "Pathname with anchor and line specification.
+Bug: With line spec looks in the wrong folder for the file?"
+ :expected-result :failed
+ (unwind-protect
+ (with-temp-buffer
+ (insert "\"${hyperb:dir}/DEMO#Smart Keys:2\"")
+ (goto-char 2)
+ (action-key)
+ (should (string= "DEMO" (buffer-name)))
+ (forward-line -2)
+ (should (looking-at "\* Smart Keys")))
+ (kill-buffer "DEMO")))
+
+(ert-deftest hbut-pathname-line-column-test ()
+ "Pathname with line and position specification."
+ (unwind-protect
+ (with-temp-buffer
+ (insert "\"${hyperb:dir}/DEMO:3:45\"")
+ (goto-char 2)
+ (action-key)
+ (should (string= "DEMO" (buffer-name)))
+ (should (= (line-number-at-pos) 3))
+ (should (= (current-column) 45)))
+ (kill-buffer "DEMO")))
+
+(ert-deftest hbut-pathname-load-path-line-column-test ()
+ "Pathname with `load-path', line and position specification."
+ (unwind-protect
+ (with-temp-buffer
+ (insert "\"${load-path}/hypb.el:10:5\"")
+ (goto-char 2)
+ (action-key)
+ (should (string= "hypb.el" (buffer-name)))
+ (should (= (line-number-at-pos) 10))
+ (should (= (current-column) 5)))
+ (kill-buffer "hypb.el")))
+
+(ert-deftest hbut-pathname-with-dash-loads-file-test ()
+ "Pathname with dash loads file."
+ (with-temp-buffer
+ (insert "\"-${hyperb:dir}/test/hy-test-dependencies.el\"")
+ (goto-char 2)
+ (action-key)
+ (hy-test-helpers:should-last-message "Loading")
+ (hy-test-helpers:should-last-message "hy-test-dependencies.el")))
+
+(ert-deftest hbut-pathname-directory-test ()
+ "Pathname with directory opens dired."
+ (unwind-protect
+ (with-temp-buffer
+ (insert "\"/tmp\"")
+ (goto-char 2)
+ (action-key)
+ (should (string= "tmp" (buffer-name)))
+ (should (eq major-mode 'dired-mode)))
+ (kill-buffer "tmp")))
+
+(ert-deftest hbut-pathname-dot-slash-in-other-folder-should-fail-test ()
+ "Pathname that starts with ./ only works if in same folder."
+ (with-temp-buffer
+ (insert "\"./hypb.el\"")
+ (goto-char 2)
+ (let ((help-buffer "*Help: Hyperbole Action Key*")
+ (default-directory (expand-file-name "test" hyperb:dir)))
+ (condition-case err
+ (action-key)
+ (error
+ (progn
+ (should (equal (car err) 'error))
+ (should (string-search
+ "(Hyperbole Action Key): No action defined for this
context; try another location"
+ (cadr err)))))))))
+
+;; hbut-annot-bib
+(ert-deftest hbut-annot-bib-test ()
+ (unwind-protect
+ (progn
+ (hypb:display-file-with-logo (expand-file-name "DEMO" hyperb:dir))
+ (re-search-forward "\\[FSF 19\\]")
+ (backward-char 1)
+ (action-key)
+ (should (looking-at "\\[FSF 19\\] Free Software Foundation"))
+ (forward-line -2)
+ (should (looking-at "\\* References")))
+ (kill-buffer "DEMO")))
+
+;; ctags
+; Seems ctags -v does not give the proper answer
+(ert-deftest hbut-ctags-vgrind-test ()
+ (unwind-protect
+ (with-temp-buffer
+ (insert "hy-test-helpers:consume-input-events hy-test-helpers.el 21\n")
+ (goto-char (point-min))
+ (forward-char 4)
+ (let ((default-directory (expand-file-name "test" hyperb:dir)))
+ (action-key)
+ (set-buffer "hy-test-helpers.el")
+ (should (looking-at "(defun hy-test-helpers:consume-input-events"))))
+ (kill-buffer "hy-test-helpers.el")))
+
+;; etags
+(ert-deftest ibtypes::etags-test ()
+ (unwind-protect
+ (with-temp-buffer
+ (insert "\n")
+ (insert "hy-test-helpers.el,103\n")
+ (insert "(defun hy-test-helpers:consume-input-events 21,359\n")
+ (rename-buffer (concat "TAGS" (buffer-name)))
+ (goto-char (point-min))
+ (forward-line 2)
+ (forward-char 10)
+ (let ((default-directory (expand-file-name "test" hyperb:dir)))
+ (action-key)
+ (set-buffer "hy-test-helpers.el")
+ (should (looking-at "(defun hy-test-helpers:consume-input-events"))))
+ (kill-buffer "hy-test-helpers.el")))
+
+;; text-toc
+(ert-deftest hbut-text-toc-test ()
+ (unwind-protect
+ (progn
+ (hypb:display-file-with-logo (expand-file-name "DEMO" hyperb:dir))
+ (goto-char (point-min))
+ (re-search-forward " \* Koutl")
+ (action-key)
+ (should (bolp))
+ (should (looking-at "^* Koutliner")))
+ (kill-buffer "DEMO")))
+
+;; dir-summary
+(ert-deftest hbut-dir-summary-test ()
+ (unwind-protect
+ (progn
+ (find-file (expand-file-name "MANIFEST" hyperb:dir))
+ (goto-char (point-min))
+ (re-search-forward "HY-ABOUT")
+ (forward-char -2)
+ (let ((hpath:display-where 'this-window))
+ (action-key)
+ (should (string= "HY-ABOUT" (buffer-name)))))
+ (progn
+ (kill-buffer "MANIFEST")
+ (kill-buffer "HY-ABOUT"))))
+
+;; rfc
+(ert-deftest hbut-rfc-test ()
+ (dolist (rfc '("RFC822" "RFC-822" "rfc 822"))
+ (with-temp-buffer
+ (insert rfc)
+ (goto-char 2)
+ (with-mock
+ (mock (actypes::link-to-rfc "822") => t)
+ (should (action-key))))))
+
+;; man-apropos
+(ert-deftest hbut-man-apropos-test ()
+ (with-temp-buffer
+ (insert "rm (1) - remove")
+ (goto-char 4)
+ (with-mock
+ (mock (man "rm(1)") => t)
+ (action-key))))
+
+;; info-node
+(ert-deftest hbut-info-node-test ()
+ "Got to info node."
+ (unwind-protect
+ (with-temp-buffer
+ (insert "\"(emacs)top\"")
+ (goto-char 6)
+ (action-key)
+ (should (string= "*info*" (buffer-name))))
+ (kill-buffer "*info*")))
+
+;; This file can't be byte-compiled without the `el-mock' package (because of
+;; the use of the `with-mock' macro), which is not a dependency of Hyperbole.
+;; Local Variables:
+;; no-byte-compile: t
+;; End:
+
(provide 'hbut-tests)
;;; hbut-tests.el ends here
diff --git a/test/hibtypes-tests.el b/test/hibtypes-tests.el
index 4571baf..fa12357 100644
--- a/test/hibtypes-tests.el
+++ b/test/hibtypes-tests.el
@@ -141,7 +141,9 @@
(with-temp-buffer
(insert "\"-${hyperb:dir}/test/hy-test-dependencies.el\"")
(goto-char 2)
- (ibtypes::pathname)))
+ (ibtypes::pathname)
+ (hy-test-helpers:should-last-message "Loading")
+ (hy-test-helpers:should-last-message "hy-test-dependencies.el")))
(ert-deftest ibtypes::pathname-directory-test ()
"Pathname with directory opens dired."
@@ -176,6 +178,17 @@
(set-buffer help-buffer)
(should (string-match "actype:.*link-to-file" (buffer-string))))))
+(ert-deftest ibtypes::pathname-path-variable-test ()
+ "Goto file at point in path variable."
+ (unwind-protect
+ (with-temp-buffer
+ (insert "\"/var/lib:/bar:/tmp:/foo\"")
+ (goto-char 16)
+ (ibtypes::pathname)
+ (should (string= "tmp" (buffer-name)))
+ (should (eq major-mode 'dired-mode)))
+ (kill-buffer "tmp")))
+
;; Function in buffer XEmac functionality. Is there somethign similar in Emacs?
;; ibtypes::annot-bib
@@ -311,7 +324,7 @@
;; info-node
(ert-deftest ibtypes::info-node-test ()
- "Should work with ibtypes::pathname but does not. Works with action-key!?"
+ "Go to info node."
(unwind-protect
(with-temp-buffer
(insert "\"(emacs)top\"")
diff --git a/test/hpath-tests.el b/test/hpath-tests.el
index eeabe54..2ab557d 100644
--- a/test/hpath-tests.el
+++ b/test/hpath-tests.el
@@ -24,5 +24,19 @@
(hpath:find "${hyperb:dir}/UNKNOWNFILE")
(error (should (string-match (concat hyperb:dir "UNKNOWNFILE") (cadr
err))))))
+(ert-deftest hpath:path-at-point-in-path-variable-test ()
+ "Find path at point in path variable."
+ (with-temp-buffer
+ (insert "\":foo:bar:emacs\"")
+ (goto-char 8)
+ (should (string= (hpath:at-p) "bar"))))
+
+(ert-deftest
hpath:path-at-point-in-path-variable-shorter-than-three-colons-returns-nil-test
()
+ "Do not identify path variables with less than three colons."
+ (with-temp-buffer
+ (insert "\"foo:bar:lisp\"")
+ (goto-char 7)
+ (should (not (hpath:at-p)))))
+
(provide 'hpath-tests)
;;; hpath-tests.el ends here
diff --git a/test/hui-tests.el b/test/hui-tests.el
new file mode 100644
index 0000000..81a48de
--- /dev/null
+++ b/test/hui-tests.el
@@ -0,0 +1,44 @@
+;;; hui-tests.el --- Tests for hui.el -*- lexical-binding: t;
-*-
+;;
+;; Author: Mats Lidell <matsl@gnu.org>
+;;
+;; Orig-Date: 30-Jan-21 at 12:00:00
+;;
+;; Copyright (C) 2021 Free Software Foundation, Inc.
+;; See the "HY-COPY" file for license information.
+;;
+;; This file is part of GNU Hyperbole.
+
+;;; Commentary:
+;;
+;; Tests for "../hui.el"
+
+;;; Code:
+
+(require 'ert)
+(require 'with-simulated-input)
+
+(ert-deftest hui-ibut-label-create ()
+ "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 hui-ibut-label-create-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 'hui-tests)
+;;; hui-tests.el ends here
- [elpa] externals/hyperbole updated (a0be037 -> d91d546), ELPA Syncer, 2021/04/19
- [elpa] externals/hyperbole f56dc21 1/6: Update some doc with latest changes, ELPA Syncer, 2021/04/19
- [elpa] externals/hyperbole 2b994bf 3/6: Fix remaining test case issues, except for org-mode one, ELPA Syncer, 2021/04/19
- [elpa] externals/hyperbole 69c2c7d 4/6: Small syntactic updates, ELPA Syncer, 2021/04/19
- [elpa] externals/hyperbole 84e1b11 2/6: Update kotl-orgtbl.el with Copyright and doc, ELPA Syncer, 2021/04/19
- [elpa] externals/hyperbole c5dbb88 5/6: Bunch of fixes and improvements in prep for next release, ELPA Syncer, 2021/04/19
- [elpa] externals/hyperbole d91d546 6/6: Merge branch 'master' of hyperbole,
ELPA Syncer <=