From a77204c64659147794b1c9f4114091a257205a49 Mon Sep 17 00:00:00 2001 From: Jim Porter Date: Fri, 30 Dec 2022 10:40:08 -0800 Subject: [PATCH] ; Fix Eshell tests on macOS * test/lisp/eshell/esh-cmd-tests.el (esh-cmd-test/if-statement-pipe) (esh-cmd-test/if-else-statement-pipe): * test/lisp/eshell/esh-io-tests.el (esh-io-test/pipeline/subcommands): Allow trailing newlines in the output. --- test/lisp/eshell/esh-cmd-tests.el | 30 ++++++++++++++++-------------- test/lisp/eshell/esh-io-tests.el | 5 +++-- 2 files changed, 19 insertions(+), 16 deletions(-) diff --git a/test/lisp/eshell/esh-cmd-tests.el b/test/lisp/eshell/esh-cmd-tests.el index cc40dde3552..42d24967ff8 100644 --- a/test/lisp/eshell/esh-cmd-tests.el +++ b/test/lisp/eshell/esh-cmd-tests.el @@ -274,24 +274,26 @@ This tests when `eshell-lisp-form-nil-is-failure' is nil." (ert-deftest esh-cmd-test/if-statement-pipe () "Test invocation of an if statement piped to another command." (skip-unless (executable-find "rev")) - (let ((eshell-test-value t)) - (eshell-command-result-equal "if $eshell-test-value {echo yes} | rev" - "sey")) - (let ((eshell-test-value nil)) - (eshell-command-result-equal "if $eshell-test-value {echo yes} | rev" - nil))) + (with-temp-eshell + (let ((eshell-test-value t)) + (eshell-match-command-output "if $eshell-test-value {echo yes} | rev" + "\\`sey\n?")) + (let ((eshell-test-value nil)) + (eshell-match-command-output "if $eshell-test-value {echo yes} | rev" + "\\`\n?")))) (ert-deftest esh-cmd-test/if-else-statement-pipe () "Test invocation of an if/else statement piped to another command." (skip-unless (executable-find "rev")) - (let ((eshell-test-value t)) - (eshell-command-result-equal - "if $eshell-test-value {echo yes} {echo no} | rev" - "sey")) - (let ((eshell-test-value nil)) - (eshell-command-result-equal - "if $eshell-test-value {echo yes} {echo no} | rev" - "on"))) + (with-temp-eshell + (let ((eshell-test-value t)) + (eshell-match-command-output + "if $eshell-test-value {echo yes} {echo no} | rev" + "\\`sey\n?")) + (let ((eshell-test-value nil)) + (eshell-match-command-output + "if $eshell-test-value {echo yes} {echo no} | rev" + "\\`on\n?")))) (ert-deftest esh-cmd-test/unless-statement () "Test invocation of an unless statement." diff --git a/test/lisp/eshell/esh-io-tests.el b/test/lisp/eshell/esh-io-tests.el index 0f09afa19e4..52501f5bb70 100644 --- a/test/lisp/eshell/esh-io-tests.el +++ b/test/lisp/eshell/esh-io-tests.el @@ -320,8 +320,9 @@ stdout originally pointed (the terminal)." (ert-deftest esh-io-test/pipeline/subcommands () "Chek that all commands in a subcommand are properly piped." (skip-unless (executable-find "rev")) - (eshell-command-result-equal "{echo foo; echo bar} | rev" - "raboof")) + (with-temp-eshell + (eshell-match-command-output "{echo foo; echo bar} | rev" + "\\`raboof\n?"))) ;; Virtual targets -- 2.39.2