From: Jim Porter <jporterbugs@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: Shell quoting in Eshell (was: eshell-batch-file)
Date: Sat, 15 Jun 2024 13:06:53 -0700 [thread overview]
Message-ID: <bdf43787-b0d7-0d4b-573f-7c336708ddb5@gmail.com> (raw)
In-Reply-To: <86y176rpiu.fsf@gnu.org>
[-- Attachment #1: Type: text/plain, Size: 706 bytes --]
On 6/15/2024 12:10 PM, Eli Zaretskii wrote:
> Test esh-cmd-test/which/plain/external-program condition:
[snip]
> :value nil :explanation
> (nonequal-result (command "which sh")
> (result #("D:/usr/MSYS/bin/sh.exe\n" 22 23 ...))
> (expected "d:/usr/MSYS/bin/sh.exe\n"))))
> FAILED 59/66 esh-cmd-test/which/plain/external-program (0.003953 sec) at lisp/eshell/esh-cmd-tests.el:538
>
> IOW: you run "which SOMETHING" and pretend to know how it will
> capitalize the drive letter.
Ah ha! If that's the only failure, then I think this would work? (If
there are other failures, then I could add a PREDICATE argument to
'eshell-command-result-equal' and use that in the necessary places.)
[-- Attachment #2: eshell-which.diff --]
[-- Type: text/plain, Size: 1843 bytes --]
diff --git a/test/lisp/eshell/esh-cmd-tests.el b/test/lisp/eshell/esh-cmd-tests.el
index 166a0ba1fff..9799afa5665 100644
--- a/test/lisp/eshell/esh-cmd-tests.el
+++ b/test/lisp/eshell/esh-cmd-tests.el
@@ -538,8 +538,12 @@ esh-cmd-test/which/plain/eshell-builtin
(ert-deftest esh-cmd-test/which/plain/external-program ()
"Check that `which' finds external programs."
(skip-unless (executable-find "sh"))
- (eshell-command-result-equal "which sh"
- (concat (executable-find "sh") "\n")))
+ (ert-info (#'eshell-get-debug-logs :prefix "Command logs: ")
+ (let ((actual (eshell-test-command-result "which sh"))
+ (expected (concat (executable-find "sh") "\n")))
+ (should (if (file-name-case-insensitive-p actual)
+ (string-equal-ignore-case actual expected)
+ (string-equal actual expected))))))
(ert-deftest esh-cmd-test/which/plain/not-found ()
"Check that `which' reports an error for not-found commands."
diff --git a/test/lisp/eshell/eshell-tests-helpers.el b/test/lisp/eshell/eshell-tests-helpers.el
index acbe57a7283..bfd829c95e9 100644
--- a/test/lisp/eshell/eshell-tests-helpers.el
+++ b/test/lisp/eshell/eshell-tests-helpers.el
@@ -179,12 +179,7 @@ eshell-test-command-result
(defun eshell-command-result--equal (_command actual expected)
"Compare the ACTUAL result of a COMMAND with its EXPECTED value."
- (or (equal actual expected)
- ;; Compare case-isensitively on case-insensitive filesystems.
- (and (memq system-type '(windows-nt ms-dos))
- (stringp actual)
- (stringp expected)
- (string-equal-ignore-case actual expected))))
+ (equal actual expected))
(defun eshell-command-result--equal-explainer (command actual expected)
"Explain the result of `eshell-command-result--equal'."
next prev parent reply other threads:[~2024-06-15 20:06 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-09 6:11 eshell-batch-file Eli Zaretskii
2024-06-09 18:55 ` eshell-batch-file Jim Porter
2024-06-09 19:06 ` eshell-batch-file Eli Zaretskii
2024-06-09 19:15 ` Shell quoting in Eshell (was: eshell-batch-file) Eli Zaretskii
2024-06-09 20:07 ` Jim Porter
2024-06-09 22:37 ` Jim Porter
2024-06-15 9:38 ` Eli Zaretskii
2024-06-15 18:36 ` Jim Porter
2024-06-15 19:10 ` Eli Zaretskii
2024-06-15 20:06 ` Jim Porter [this message]
2024-06-16 5:21 ` Eli Zaretskii
2024-06-16 5:57 ` Jim Porter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=bdf43787-b0d7-0d4b-573f-7c336708ddb5@gmail.com \
--to=jporterbugs@gmail.com \
--cc=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).