]> git.eshelyaron.com Git - emacs.git/commitdiff
; Fix Eshell tests
authorJim Porter <jporterbugs@gmail.com>
Mon, 14 Aug 2023 16:20:34 +0000 (09:20 -0700)
committerJim Porter <jporterbugs@gmail.com>
Mon, 14 Aug 2023 16:20:34 +0000 (09:20 -0700)
* 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
test/lisp/eshell/eshell-tests.el

index 1184b5df5f8e3ac8e7c53f864a9c5508dc393517..bdffcd9b320c5b74b8334df66c5fe29087e79e92 100644 (file)
             ;; 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))
index 390f75cfbb969742b632b85d2cd864d73da876e7..46c9482ecf49db4b686ad45148efe84c785d083b 100644 (file)
@@ -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.