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

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

[elpa] externals/hyperbole 2b42243bb7: Tests for shell related key serie


From: ELPA Syncer
Subject: [elpa] externals/hyperbole 2b42243bb7: Tests for shell related key series examples in the fast demo (#198)
Date: Tue, 14 Jun 2022 05:01:54 -0400 (EDT)

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

    Tests for shell related key series examples in the fast demo (#198)
    
    * Tests for shell related key series examples in the fast demo
    
    * Use accept-process-output
---
 ChangeLog          |  6 ++++++
 test/demo-tests.el | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 66 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index 1845c22662..6931abafe9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2022-06-13  Mats Lidell  <matsl@gnu.org>
+
+* test/demo-tests.el (fast-demo-key-series-shell-pushd-hyperb-dir)
+    (fast-demo-key-series-shell-grep, fast-demo-key-series-shell-apropos):
+    Tests for shell related key series examples in the fast demo.
+
 2022-06-12  Mats Lidell  <matsl@gnu.org>
 
 * hib-kbd.el: Replace \\s- with [ \t\n\r\f] to eliminate mode based
diff --git a/test/demo-tests.el b/test/demo-tests.el
index a10c4d769c..2191e6d0ff 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:      9-Jun-22 at 21:58:42 by Mats Lidell
+;; Last-Mod:     14-Jun-22 at 00:26:10 by Mats Lidell
 ;;
 ;; Copyright (C) 2021  Free Software Foundation, Inc.
 ;; See the "HY-COPY" file for license information.
@@ -528,6 +528,65 @@ enough files with matching mode loaded."
       (global-set-key (kbd "C-x C-b") old)
       (kill-buffer dir))))
 
+(ert-deftest fast-demo-key-series-shell-pushd-hyperb-dir ()
+  "Action key executes pushd shell command."
+  (skip-unless (not noninteractive))
+  (let ((shell-file-name (executable-find "bash"))
+        (shell-buffer-name "*shell*"))
+    (unwind-protect
+        (with-temp-buffer
+          (insert "{ M-x shell RET M-> (pushd ${hyperb:dir} && echo 
\"PWD=$(pwd)\") RET }")
+          (goto-char 5)
+          (action-key)
+          (hy-test-helpers:consume-input-events)
+          (with-current-buffer shell-buffer-name
+            (goto-char (point-min))
+            (end-of-line)
+            (with-timeout (5 (ert-fail "Test timed out"))
+              (while (not (search-forward "PWD=" nil t))
+                (accept-process-output (get-buffer-process 
shell-buffer-name))))
+            (should (looking-at-p (directory-file-name hyperb:dir)))))
+      (set-process-query-on-exit-flag (get-buffer-process shell-buffer-name) 
nil)
+      (kill-buffer shell-buffer-name))))
+
+(ert-deftest fast-demo-key-series-shell-grep ()
+  "Action key executes grep shell command."
+  (skip-unless (not noninteractive))
+  (let ((shell-file-name (executable-find "bash"))
+        (shell-buffer-name "*shell*"))
+    (unwind-protect
+        (with-temp-buffer
+          (insert "{M-x shell RET M-> (export HYPERBOLE_DIR=${hyperb:dir} && 
cd $HYPERBOLE_DIR && grep -n gbut:label-list *.el) RET}")
+          (goto-char 5)
+          (action-key)
+          (hy-test-helpers:consume-input-events)
+          (with-current-buffer shell-buffer-name
+            (with-timeout (5 (ert-fail "Test timed out"))
+              (while (not (string-match-p 
"\n.*\.el:[0-9]+:.*defun.*gbut:label-list \(\)" (buffer-substring-no-properties 
(point-min) (point-max))))
+                (accept-process-output (get-buffer-process 
shell-buffer-name))))
+            (should (string-match-p "\n.*\.el:[0-9]+:.*defun.*gbut:label-list 
\(\)" (buffer-substring-no-properties (point-min) (point-max))))))
+      (set-process-query-on-exit-flag (get-buffer-process shell-buffer-name) 
nil)
+      (kill-buffer shell-buffer-name))))
+
+(ert-deftest fast-demo-key-series-shell-apropos ()
+  "Action key executes apropos shell command."
+  (skip-unless (not noninteractive))
+  (let ((shell-file-name (executable-find "bash"))
+        (shell-buffer-name "*shell*"))
+    (unwind-protect
+        (with-temp-buffer
+          (insert "{M-x shell RET M-> (apropos grep) RET}")
+          (goto-char 5)
+          (action-key)
+          (hy-test-helpers:consume-input-events)
+          (with-current-buffer shell-buffer-name
+            (with-timeout (5 (ert-fail "Test timed out"))
+              (while (not (string-match-p "\ngrep \(1\).*-" 
(buffer-substring-no-properties (point-min) (point-max))))
+                (accept-process-output (get-buffer-process 
shell-buffer-name))))
+            (should (string-match-p "\ngrep \(1\).*-" 
(buffer-substring-no-properties (point-min) (point-max))))))
+      (set-process-query-on-exit-flag (get-buffer-process shell-buffer-name) 
nil)
+      (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.
 ;;  Local Variables:



reply via email to

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