From 279e3723b10a8aa8323f9094f7f1e7d52820bcec Mon Sep 17 00:00:00 2001 From: Jim Porter Date: Mon, 14 Aug 2023 09:20:34 -0700 Subject: [PATCH] ; 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-name temp-buffer) - input)))) + (string-replace + "#" + (concat "#") + 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. -- 2.39.2