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

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

[elpa] externals/hyperbole 80d1d2dd4c 12/19: Update tests to work with n


From: ELPA Syncer
Subject: [elpa] externals/hyperbole 80d1d2dd4c 12/19: Update tests to work with new ibut:create code
Date: Sun, 24 Jul 2022 16:57:38 -0400 (EDT)

branch: externals/hyperbole
commit 80d1d2dd4c4ab7a23cc6f00e4821803d5ab93e93
Author: Bob Weiner <rsw@gnu.org>
Commit: Bob Weiner <rsw@gnu.org>

    Update tests to work with new ibut:create code
---
 ChangeLog                    | 19 +++++++++++
 test/demo-tests.el           | 76 +++++++++++++++++++++-----------------------
 test/hbut-tests.el           | 15 +++++----
 test/hui-tests.el            | 10 +++---
 test/hy-test-dependencies.el | 18 ++++-------
 test/hy-test-helpers.el      |  7 +++-
 6 files changed, 82 insertions(+), 63 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 1ba09c5ca7..3364aafea8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,22 @@
+* hib-debbugs.el (debbugs-version-sufficient-p): Handle if version
+    is nil due to edebug mocking of 'find-file-noselect'.
+  test/hui-tests.el (hui-gibut-create-link-to-file,
+    hui-gibut-create-link-to-file-line,
+    hui-gibut-create-link-to-file-line-and-column):
+  test/hbut-tests.el (gbut-program-calls-ebut-program)
+    gbut-program-link-to-directory, gbut-program-eval-elisp,
+    gbut-program-link-to-file, gbut-program-link-to-file-line,
+    gbut-program-link-to-file-line-and-column):
+      Replace mock of 'find-file-noselect' with 'hpath:find-noselect'
+      so tests do not interfere with other calls to 'find-file-noselect'.
+
+* test/hy-test-helpers.el (hy-test-helpers:kill-buffer):
+    Add to kill buffers only when they exist.
+  test/demo-tests.el (fast-demo-key-series-shell-apropos):
+    Use 'hy-test-helpers:kill-buffer'.
+  test/hy-test-dependencies.el (hy-test-ensure-package-installed):
+    Simplified by defining this function.
+
 2022-07-17  Bob Weiner  <rsw@gnu.org>
 
 * hmouse-drv.el (hkey-debug): Add print of all button properties when on
diff --git a/test/demo-tests.el b/test/demo-tests.el
index 76b9c7b2ac..035599546a 100644
--- a/test/demo-tests.el
+++ b/test/demo-tests.el
@@ -3,7 +3,7 @@
 ;; Author:       Mats Lidell <matsl@gnu.org>
 ;;
 ;; Orig-Date:    30-Jan-21 at 12:00:00
-;; Last-Mod:     17-Jul-22 at 14:31:49 by Bob Weiner
+;; Last-Mod:     23-Jul-22 at 19:18:48 by Bob Weiner
 ;;
 ;; Copyright (C) 2021  Free Software Foundation, Inc.
 ;; See the "HY-COPY" file for license information.
@@ -43,7 +43,7 @@
         (action-key)
         (should (bolp))
         (should (looking-at "^\\* Smart")))
-    (kill-buffer "DEMO")))
+    (hy-test-helpers:kill-buffer "DEMO")))
 
 (ert-deftest demo-smart-mouse-keys-ebut-test ()
   (unwind-protect
@@ -54,7 +54,7 @@
         (action-key)
         (should (bolp))
         (should (looking-at "^ +\\* Smart")))
-    (kill-buffer "DEMO")))
+    (hy-test-helpers:kill-buffer "DEMO")))
 
 (ert-deftest demo-table-of-contents-test ()
   (unwind-protect
@@ -65,7 +65,7 @@
         (action-key)
         (should (bolp))
         (should (looking-at "^* Koutliner")))
-    (kill-buffer "DEMO")))
+    (hy-test-helpers:kill-buffer "DEMO")))
 
 ;; Smart scrolling
 (ert-deftest demo-smart-scrolling-proportional-test ()
@@ -81,7 +81,7 @@
           (end-of-line)
           (action-key)
           (should (= pos (window-start)))))
-    (kill-buffer "DEMO")))
+    (hy-test-helpers:kill-buffer "DEMO")))
 
 (ert-deftest demo-smart-scrolling-non-proportional-test ()
   (unwind-protect
@@ -95,32 +95,30 @@
           (end-of-line)
           (action-key)
           (should (< pos (window-start)))))
-    (kill-buffer "DEMO")))
+    (hy-test-helpers:kill-buffer "DEMO")))
 
 ;; Hyperbole menus
 
 ;; Help Buffer
 (ert-deftest demo-action-key-help ()
   (let ((help-buffer "*Help: Hyperbole Action Key*"))
-    (if (get-buffer help-buffer)
-        (kill-buffer help-buffer))
+    (hy-test-helpers:kill-buffer help-buffer)
     (unwind-protect
         (with-temp-buffer
           (insert "Text")
           (hkey-help)
           (should (get-buffer help-buffer))
-      (kill-buffer help-buffer)))))
+      (hy-test-helpers:kill-buffer help-buffer)))))
 
 (ert-deftest demo-assist-key-help ()
   (let ((help-buffer "*Help: Hyperbole Assist Key*"))
-    (if (get-buffer help-buffer)
-        (kill-buffer help-buffer))
+    (hy-test-helpers:kill-buffer help-buffer)
     (unwind-protect
         (with-temp-buffer
           (insert "Text")
           (hkey-help t)
           (should (get-buffer help-buffer))
-      (kill-buffer help-buffer)))))
+      (hy-test-helpers:kill-buffer help-buffer)))))
 
 ;; Hy-control
 (ert-deftest demo-window-grid-22-test ()
@@ -131,7 +129,7 @@
         (should (hact 'kbd-key "C-h h s f @ 22 RET Q"))
         (hy-test-helpers:consume-input-events)
         (should (eq 4 (length (window-list)))))
-    (kill-buffer "DEMO")))
+    (hy-test-helpers:kill-buffer "DEMO")))
 
 (ert-deftest demo-window-grid-33-test ()
   (skip-unless (not noninteractive))
@@ -141,7 +139,7 @@
         (should (hact 'kbd-key "C-h h s f @ 33 RET Q"))
         (hy-test-helpers:consume-input-events)
         (should (eq 9 (length (window-list)))))
-    (kill-buffer "DEMO")))
+    (hy-test-helpers:kill-buffer "DEMO")))
 
 ;; Hy-rolo
 (ert-deftest demo-hy-rolo-test ()
@@ -163,7 +161,7 @@
         (goto-char 5)
         (action-key)
         (should (string= "*info*" (buffer-name))))
-    (kill-buffer "*info*")))
+    (hy-test-helpers:kill-buffer "*info*")))
 
 ;; History
 (ert-deftest demo-hy-history-test ()
@@ -181,7 +179,7 @@
           (should (string= tmp-buf-name (buffer-name)))
           (should (equal pm (point-marker)))
           ))
-    (kill-buffer "*info*")))
+    (hy-test-helpers:kill-buffer "*info*")))
 
 ;; Implicit Buttons
 (ert-deftest demo-implicit-button-test ()
@@ -191,7 +189,7 @@
         (goto-char 2)
         (action-key)
         (should (string= "DEMO" (buffer-name))))
-    (kill-buffer "DEMO")))
+    (hy-test-helpers:kill-buffer "DEMO")))
 
 (ert-deftest demo-implicit-button-action-button-action-type-invocation-test ()
   (unwind-protect
@@ -201,7 +199,7 @@
         (action-key)
         (should (string= "DEMO" (buffer-name)))
         (should (= 5 (line-number-at-pos (point)))))
-    (kill-buffer "DEMO")))
+    (hy-test-helpers:kill-buffer "DEMO")))
 
 (ert-deftest demo-implicit-button-action-button-function-call-test ()
   (with-temp-buffer
@@ -252,7 +250,7 @@
         (action-key)
         (should (string= "README.md" (buffer-name)))
         (should (looking-at "## Why was Hyperbole developed\\?")))
-    (kill-buffer "README.md")))
+    (hy-test-helpers:kill-buffer "README.md")))
 
 (ert-deftest demo-implicit-button-line-and-column-test ()
   (unwind-protect
@@ -262,7 +260,7 @@
         (action-key)
         (should (string= "HY-ABOUT" (buffer-name)))
         (should (looking-at "hyperbole/")))
-    (kill-buffer "HY-ABOUT")))
+    (hy-test-helpers:kill-buffer "HY-ABOUT")))
 
 ;; org
 (ert-deftest demo-org-hide-header-test ()
@@ -293,8 +291,8 @@
         (should (string= "COPYING" (buffer-name)))
         (should (looking-at ".*GNU GENERAL PUBLIC LICENSE")))
     (progn
-      (kill-buffer "MANIFEST")
-      (kill-buffer "COPYING"))))
+      (hy-test-helpers:kill-buffer "MANIFEST")
+      (hy-test-helpers:kill-buffer "COPYING"))))
 
 ;; Email compose
 (ert-deftest demo-mail-compose-test ()
@@ -304,7 +302,7 @@
         (goto-char 2)
         (action-key)
         (should (string= "*mail*" (buffer-name))))
-    (kill-buffer "*mail*")))
+    (hy-test-helpers:kill-buffer "*mail*")))
 
 
 (defun demo-should-browse-twitter-url (url &optional new-window)
@@ -363,8 +361,8 @@
         (set-buffer "*Occur*")
         (should (looking-at "[0-9]+ matches in [0-9]+ lines for \"Hyperbole\" 
in buffer: DEMO")))
     (progn
-      (kill-buffer "DEMO")
-      (kill-buffer "*Occur*"))))
+      (hy-test-helpers:kill-buffer "DEMO")
+      (hy-test-helpers:kill-buffer "*Occur*"))))
 
 ;; Annotated references
 (ert-deftest demo-annotated-reference-test ()
@@ -377,7 +375,7 @@
         (should (looking-at "\\[FSF 19\\] Free Software Foundation"))
         (forward-line -2)
         (should (looking-at "\\* References")))
-    (kill-buffer "DEMO")))
+    (hy-test-helpers:kill-buffer "DEMO")))
 
 ;; Man appropos
 (ert-deftest demo-man-appropos-test ()
@@ -397,7 +395,7 @@
         (should (hact 'kbd-key "C-h h a factorial RET"))
         (hy-test-helpers:consume-input-events)
         (hy-test-helpers:should-last-message "Factorial of 5 = 120"))
-    (kill-buffer "DEMO")))
+    (hy-test-helpers:kill-buffer "DEMO")))
 
 (ert-deftest demo-factorial-ebutton-test ()
   (skip-unless (not noninteractive))
@@ -408,7 +406,7 @@
         (forward-char -5)
         (action-key)
         (hy-test-helpers:should-last-message "Factorial of 5 = 120"))
-    (kill-buffer "DEMO")))
+    (hy-test-helpers:kill-buffer "DEMO")))
 
 ;; Fast demo key series
 (ert-deftest fast-demo-key-series-help-buffer ()
@@ -420,7 +418,7 @@
           (goto-char 3)
           (action-key)
           (should (get-buffer help-buffer)))
-      (kill-buffer help-buffer))))
+      (hy-test-helpers:kill-buffer help-buffer))))
 
 (ert-deftest fast-demo-key-series-window-grid-22 ()
   "Action key on window grid key series creates a grid."
@@ -444,7 +442,7 @@ hyberbole folder that starts with kotl."
         (action-key)
         (hy-test-helpers:consume-input-events)
         (should (= 4 (length (window-list)))))
-    (kill-buffer "FAST-DEMO")))
+    (hy-test-helpers:kill-buffer "FAST-DEMO")))
 
 (ert-deftest fast-demo-key-series-emacs-lisp-mode ()
   "Action key brings up `emacs-lisp-mode' files in a grid.
@@ -485,9 +483,9 @@ enough files with matching mode loaded."
           (hy-test-helpers:consume-input-events)
           (with-current-buffer buff
             (should (looking-at-p (concat ".*" tmp)))))
-      (kill-buffer buff)
+      (hy-test-helpers:kill-buffer buff)
       (global-set-key (kbd "C-x C-b") old)
-      (kill-buffer (get-file-buffer tmp))
+      (hy-test-helpers:kill-buffer (get-file-buffer tmp))
       (delete-file tmp))))
 
 (ert-deftest fast-demo-key-series-keep-lines-slash ()
@@ -505,9 +503,9 @@ enough files with matching mode loaded."
           (hy-test-helpers:consume-input-events)
           (with-current-buffer buff
             (should (looking-at-p (concat ".*[\\/]")))))
-      (kill-buffer buff)
+      (hy-test-helpers:kill-buffer buff)
       (global-set-key (kbd "C-x C-b") old)
-      (kill-buffer dir))))
+      (hy-test-helpers:kill-buffer dir))))
 
 (ert-deftest fast-demo-key-series-keep-lines-dired ()
   "Action key opens Ibuffer and keep `dired-mode' lines."
@@ -524,9 +522,9 @@ enough files with matching mode loaded."
           (hy-test-helpers:consume-input-events)
           (with-current-buffer buff
             (should (looking-at-p (concat ".*Dired by name")))))
-      (kill-buffer buff)
+      (hy-test-helpers:kill-buffer buff)
       (global-set-key (kbd "C-x C-b") old)
-      (kill-buffer dir))))
+      (hy-test-helpers:kill-buffer dir))))
 
 (ert-deftest fast-demo-key-series-shell-pushd-hyperb-dir ()
   "Action key executes pushd shell command."
@@ -549,7 +547,7 @@ enough files with matching mode loaded."
             (should (looking-at-p (directory-file-name hyperb:dir)))))
       (unless existing-shell-flag
        (set-process-query-on-exit-flag (get-buffer-process shell-buffer-name) 
nil)
-       (kill-buffer shell-buffer-name)))))
+       (hy-test-helpers:kill-buffer shell-buffer-name)))))
 
 (ert-deftest fast-demo-key-series-shell-grep ()
   "Action key executes grep shell command."
@@ -570,7 +568,7 @@ enough files with matching mode loaded."
             (should (string-match-p "\n.*\\.el:[0-9]+:.*defun.*gbut:label-list 
()" (buffer-substring-no-properties (point-min) (point-max))))))
       (unless existing-shell-flag
        (set-process-query-on-exit-flag (get-buffer-process shell-buffer-name) 
nil)
-       (kill-buffer shell-buffer-name)))))
+       (hy-test-helpers:kill-buffer shell-buffer-name)))))
 
 (ert-deftest fast-demo-key-series-shell-apropos ()
   "Action key executes apropos shell command."
@@ -591,7 +589,7 @@ enough files with matching mode loaded."
             (should (string-match-p "\ngrep ?(1).*-" 
(buffer-substring-no-properties (point-min) (point-max))))))
       (unless existing-shell-flag
        (set-process-query-on-exit-flag (get-buffer-process shell-buffer-name) 
nil)
-       (kill-buffer shell-buffer-name)))))
+       (hy-test-helpers:kill-buffer shell-buffer-name)))))
 
 ;; 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.
diff --git a/test/hbut-tests.el b/test/hbut-tests.el
index 6238c213b5..25d703ca99 100644
--- a/test/hbut-tests.el
+++ b/test/hbut-tests.el
@@ -3,7 +3,7 @@
 ;; Author:       Mats Lidell <matsl@gnu.org>
 ;;
 ;; Orig-Date:    30-may-21 at 09:33:00
-;; Last-Mod:     22-May-22 at 10:57:31 by Mats Lidell
+;; Last-Mod:     23-Jul-22 at 20:04:45 by Bob Weiner
 ;;
 ;; Copyright (C) 2021-2022  Free Software Foundation, Inc.
 ;; See the "HY-COPY" file for license information.
@@ -19,6 +19,7 @@
 (require 'ert)
 (require 'hbut)
 (require 'hactypes)
+(require 'hpath)
 (require 'el-mock)
 
 (defun hbut-tests:should-match-tmp-folder (tmp)
@@ -79,7 +80,7 @@ Needed since hyperbole expands all links to absolute paths and
     (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 (hpath:find-noselect (expand-file-name hbmap:filename 
hbmap:dir-user)) => test-buffer)
           (mock (ebut:program "label" 'link-to-directory "/tmp") => t)
           (gbut:ebut-program "label" 'link-to-directory "/tmp"))
       (delete-file test-file))))
@@ -91,7 +92,7 @@ Needed since hyperbole expands all links to absolute paths and
     (unwind-protect
        (progn
           (with-mock
-            (mock (find-file-noselect (expand-file-name hbmap:filename 
hbmap:dir-user)) => test-buffer)
+            (mock (hpath:find-noselect (expand-file-name hbmap:filename 
hbmap:dir-user)) => test-buffer)
             (gbut:ebut-program "global" 'link-to-directory "/tmp"))
          (with-current-buffer test-buffer
             (should (eq (hattr:get (hbut:at-p) 'actype) 
'actypes::link-to-directory))
@@ -107,7 +108,7 @@ Needed since hyperbole expands all links to absolute paths 
and
     (unwind-protect
        (progn
           (with-mock
-            (mock (find-file-noselect (expand-file-name hbmap:filename 
hbmap:dir-user)) => test-buffer)
+            (mock (hpath:find-noselect (expand-file-name hbmap:filename 
hbmap:dir-user)) => test-buffer)
             (gbut:ebut-program "global" 'eval-elisp '()))
          (with-current-buffer test-buffer
             (hy-test-helpers-verify-hattr-at-p :actype 'actypes::eval-elisp 
:args  '(()) :loc test-file :lbl-key "global")))
@@ -120,7 +121,7 @@ Needed since hyperbole expands all links to absolute paths 
and
     (unwind-protect
        (progn
           (with-mock
-            (mock (find-file-noselect (expand-file-name hbmap:filename 
hbmap:dir-user)) => test-buffer)
+            (mock (hpath:find-noselect (expand-file-name hbmap:filename 
hbmap:dir-user)) => test-buffer)
             (gbut:ebut-program "global" 'link-to-file test-file))
          (with-current-buffer test-buffer
             (hy-test-helpers-verify-hattr-at-p :actype 'actypes::link-to-file 
:args (list test-file) :loc test-file :lbl-key "global")))
@@ -133,7 +134,7 @@ Needed since hyperbole expands all links to absolute paths 
and
     (unwind-protect
        (progn
           (with-mock
-            (mock (find-file-noselect (expand-file-name hbmap:filename 
hbmap:dir-user)) => test-buffer)
+            (mock (hpath:find-noselect (expand-file-name hbmap:filename 
hbmap:dir-user)) => test-buffer)
             (gbut:ebut-program "global" 'link-to-file-line test-file 10))
          (with-current-buffer test-buffer
             (hy-test-helpers-verify-hattr-at-p :actype 
'actypes::link-to-file-line :args (list test-file 10) :loc test-file :lbl-key 
"global")))
@@ -146,7 +147,7 @@ Needed since hyperbole expands all links to absolute paths 
and
     (unwind-protect
        (progn
           (with-mock
-            (mock (find-file-noselect (expand-file-name hbmap:filename 
hbmap:dir-user)) => test-buffer)
+            (mock (hpath:find-noselect (expand-file-name hbmap:filename 
hbmap:dir-user)) => test-buffer)
             (gbut:ebut-program "global" 'link-to-file-line-and-column 
test-file 10 20))
          (with-current-buffer test-buffer
             (hy-test-helpers-verify-hattr-at-p :actype 
'actypes::link-to-file-line-and-column :args (list test-file 10 20) :loc 
test-file :lbl-key"global")))
diff --git a/test/hui-tests.el b/test/hui-tests.el
index 4a3a9d85af..be5ded41a1 100644
--- a/test/hui-tests.el
+++ b/test/hui-tests.el
@@ -3,7 +3,7 @@
 ;; Author:       Mats Lidell <matsl@gnu.org>
 ;;
 ;; Orig-Date:    30-Jan-21 at 12:00:00
-;; Last-Mod:     12-Jul-22 at 23:25:15 by Mats Lidell
+;; Last-Mod:     23-Jul-22 at 20:06:18 by Bob Weiner
 ;;
 ;; Copyright (C) 2021-2022  Free Software Foundation, Inc.
 ;; See the "HY-COPY" file for license information.
@@ -194,7 +194,7 @@ Ensure modifying the button but keeping the label does not 
create a double label
     (unwind-protect
        (progn
           (with-mock
-            (mock (find-file-noselect (gbut:file)) => test-buffer)
+            (mock (hpath:find-noselect (gbut:file)) => test-buffer)
             (hui:gibut-create "global" test-file))
          (with-current-buffer test-buffer
             (hy-test-helpers-verify-hattr-at-p :actype 'actypes::link-to-file 
:args (list test-file) :loc test-file :lbl-key "global")))
@@ -207,7 +207,7 @@ Ensure modifying the button but keeping the label does not 
create a double label
     (unwind-protect
        (progn
           (with-mock
-            (mock (find-file-noselect (gbut:file)) => test-buffer)
+            (mock (hpath:find-noselect (gbut:file)) => test-buffer)
             (hui:gibut-create "global" (concat test-file ":10")))
          (with-current-buffer test-buffer
             (hy-test-helpers-verify-hattr-at-p :actype 
'actypes::link-to-file-line :args (list test-file 10) :loc test-file :lbl-key 
"global")))
@@ -220,7 +220,7 @@ Ensure modifying the button but keeping the label does not 
create a double label
     (unwind-protect
        (progn
           (with-mock
-            (mock (find-file-noselect (gbut:file)) => test-buffer)
+            (mock (hpath:find-noselect (gbut:file)) => test-buffer)
             (hui:gibut-create "global" (concat test-file ":10:20")))
          (with-current-buffer test-buffer
             (hy-test-helpers-verify-hattr-at-p :actype 
'actypes::link-to-file-line-and-column :args (list test-file 10 20) :loc 
test-file :lbl-key "global")))
@@ -234,7 +234,7 @@ Ensure modifying the button but keeping the label does not 
create a double label
     (unwind-protect
        (progn
           (with-mock
-            (mock (find-file-noselect (gbut:file)) => test-buffer)
+            (mock (hpath:find-noselect (gbut:file)) => test-buffer)
             (hui:gibut-create "global" (concat "\"" info-node "\"")))
          (with-current-buffer test-buffer
             (hy-test-helpers-verify-hattr-at-p :actype 
'actypes::link-to-Info-node :args (list info-node) :loc test-file :lbl-key 
"global")))
diff --git a/test/hy-test-dependencies.el b/test/hy-test-dependencies.el
index c8e47fd814..9d65d3eb9f 100644
--- a/test/hy-test-dependencies.el
+++ b/test/hy-test-dependencies.el
@@ -3,7 +3,7 @@
 ;; Author:       Mats Lidell <matsl@gnu.org>
 ;;
 ;; Orig-Date:    20-Feb-21 at 23:16:00
-;; Last-Mod:     24-Jan-22 at 00:40:43 by Bob Weiner
+;; Last-Mod:     23-Jul-22 at 18:37:43 by Bob Weiner
 ;;
 ;; Copyright (C) 2021  Free Software Foundation, Inc.
 ;; See the "HY-COPY" file for license information.
@@ -19,17 +19,13 @@
 (package-initialize)
 (add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/";))
 
-(unless (package-installed-p 'el-mock)
-  (package-refresh-contents)
-  (package-install 'el-mock))
+(defun hy-test-ensure-package-installed (pkg-symbol)
+  (unless (package-installed-p pkg-symbol)
+    (package-refresh-contents)
+    (package-install pkg-symbol)))
 
-(unless (package-installed-p 'with-simulated-input)
-  (package-refresh-contents)
-  (package-install 'with-simulated-input))
-
-(unless (package-installed-p 'package-lint)
-  (package-refresh-contents)
-  (package-install 'package-lint))
+(mapc (lambda (sym) (hy-test-ensure-package-installed sym))
+      '(el-mock package-lint with-simulated-input))
 
 (provide 'hy-test-dependencies)
 ;;; hy-test-dependencies.el ends here
diff --git a/test/hy-test-helpers.el b/test/hy-test-helpers.el
index 18c6d84bd5..0b7d5965cb 100644
--- a/test/hy-test-helpers.el
+++ b/test/hy-test-helpers.el
@@ -3,7 +3,7 @@
 ;; Author:       Mats Lidell <matsl@gnu.org>
 ;;
 ;; Orig-Date:    30-Jan-21 at 12:00:00
-;; Last-Mod:     11-Jul-22 at 23:23:08 by Mats Lidell
+;; Last-Mod:     23-Jul-22 at 18:39:05 by Bob Weiner
 ;;
 ;; Copyright (C) 2021-2022  Free Software Foundation, Inc.
 ;; See the "HY-COPY" file for license information.
@@ -52,6 +52,11 @@
       (funcall function)
       (should was-called))))
 
+(defun hy-test-helpers:kill-buffer (buffer)
+  "Kill BUFFER if it exists."
+  (when (get-buffer buffer)
+    (kill-buffer buffer)))
+
 (cl-defun hy-test-helpers-verify-hattr-at-p (&key actype args loc lbl-key)
   "Verify the attribute of hbut at point.
 Checks ACTYPE, ARGS, LOC and LBL-KEY."



reply via email to

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