emacs-diffs
[Top][All Lists]
Advanced

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

master 279e3723b10: ; Fix Eshell tests


From: Jim Porter
Subject: master 279e3723b10: ; Fix Eshell tests
Date: Mon, 14 Aug 2023 12:22:49 -0400 (EDT)

branch: master
commit 279e3723b10a8aa8323f9094f7f1e7d52820bcec
Author: Jim Porter <jporterbugs@gmail.com>
Commit: Jim Porter <jporterbugs@gmail.com>

    ; Fix Eshell tests
    
    * test/lisp/eshell/eshell-tests.el (eshell-test/forward-arg): Add
    'should' calls to check state.
    
    * test/lisp/eshell/em-extpipe-tests.el (em-extpipe-tests--deftest):
    Add 'should' calls and fix temp-buffer substitution.
---
 test/lisp/eshell/em-extpipe-tests.el | 25 ++++++++++++++-----------
 test/lisp/eshell/eshell-tests.el     |  9 +++------
 2 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/test/lisp/eshell/em-extpipe-tests.el 
b/test/lisp/eshell/em-extpipe-tests.el
index 1184b5df5f8..bdffcd9b320 100644
--- a/test/lisp/eshell/em-extpipe-tests.el
+++ b/test/lisp/eshell/em-extpipe-tests.el
@@ -48,26 +48,29 @@
             ;; buffer into `input'.  The substitution logic is
             ;; appropriate for only the use we put it to in this file.
             `(ert-with-temp-file temp
-               (let ((temp-buffer (generate-new-buffer " *temp*" t)))
+               (let ((temp-buffer (generate-new-buffer " *tmp*" t)))
                  (unwind-protect
                      (let ((input
                             (replace-regexp-in-string
                              "temp\\([^>]\\|\\'\\)" temp
-                             (string-replace "#<buffer temp>"
-                                             (buffer-name temp-buffer)
-                                             input))))
+                             (string-replace
+                              "#<buffer temp>"
+                              (concat "#<buffer " (buffer-name temp-buffer) 
">")
+                              input))))
                        ,@body)
                    (when (buffer-name temp-buffer)
                      (kill-buffer temp-buffer))))))
           (temp-should-string= (expected)
-            `(string= ,expected (string-trim-right
-                                 (with-temp-buffer
-                                   (insert-file-contents temp)
-                                   (buffer-string)))))
+            `(should (string= ,expected
+                              (string-trim-right
+                               (with-temp-buffer
+                                 (insert-file-contents temp)
+                                 (buffer-string))))))
           (temp-buffer-should-string= (expected)
-            `(string= ,expected (string-trim-right
-                                 (with-current-buffer temp-buffer
-                                   (buffer-string))))))
+            `(should (string= ,expected
+                              (string-trim-right
+                               (with-current-buffer temp-buffer
+                                 (buffer-string)))))))
        (skip-unless shell-file-name)
        (skip-unless shell-command-switch)
        (skip-unless (executable-find shell-file-name))
diff --git a/test/lisp/eshell/eshell-tests.el b/test/lisp/eshell/eshell-tests.el
index 390f75cfbb9..46c9482ecf4 100644
--- a/test/lisp/eshell/eshell-tests.el
+++ b/test/lisp/eshell/eshell-tests.el
@@ -162,16 +162,13 @@ This test uses a pipeline for the command."
   "Test moving across command arguments"
   (with-temp-eshell
    (eshell-insert-command "echo $(+ 1 (- 4 3)) \"alpha beta\" file" 'ignore)
-   (let ((here (point)) begin valid)
+   (let ((end (point)) begin)
      (beginning-of-line)
      (setq begin (point))
      (eshell-forward-argument 4)
-     (setq valid (= here (point)))
+     (should (= end (point)))
      (eshell-backward-argument 4)
-     (prog1
-         (and valid (= begin (point)))
-       (beginning-of-line)
-       (delete-region (point) (point-max))))))
+     (should (= begin (point))))))
 
 (ert-deftest eshell-test/queue-input ()
   "Test queuing command input.



reply via email to

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