bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#57216: 29.0.50; [PATCH] Provide ERT explainers for Eshell test funct


From: Jim Porter
Subject: bug#57216: 29.0.50; [PATCH] Provide ERT explainers for Eshell test functions
Date: Sun, 14 Aug 2022 14:20:25 -0700

It can be difficult to diagnose test failures in the Eshell ERT test suite, since it doesn't print useful details like the command that was executed. See bug#57129 for example.

Here are some patches to fix that. The failures now look like this:

----------------------------------------

    (ert-test-failed
     ((should
       (eshell-match-output regexp))
      :form
      (eshell-match-output "wrong")
      :value nil :explanation
      (mismatched-output
       (command "echo $INSIDE_EMACS[, 1]\n")
       (output "eshell\n")
       (regexp "wrong"))))

----------------------------------------

    (ert-test-failed
     ((should
       (eshell-command-result--equal command
                                     (eshell-test-command-result command)
                                     result))
      :form
      (eshell-command-result--equal "echo $LINES" 22 2)
      :value nil :explanation
      (nonequal-result
       (command "echo $LINES")
       (result 22)
       (expected 2))))

----------------------------------------

Most of the first two patches are purely-mechanical changes to update function calls. The diffs ended up being pretty big, but I think it improves matters. Let me know if I should do it differently (especially for the commit message; I didn't see much benefit to listing *every* test function I touched, but maybe I should do that?)

While I was testing these, I also found a couple real bugs with the 'eshell-command-result' function. This throws 'eshell-defer':

  M-: (eshell-command-result "if {[ foo = foo ]} {echo hi}")

That's because 'eshell-do-eval' wasn't forwarding the SYNCHRONOUS-P argument in a couple spots.

This is also wrong:

  M-: (eshell-command-result "if (zerop 1) {echo yes} {echo no}")
    => nil

It should return "no".

I fixed these in the third patch. Maybe that could go in a separate bug, but it's fairly closely related to this one.

Attachment: 0001-Provide-ERT-explainer-for-eshell-match-command-outpu.patch
Description: Text document

Attachment: 0002-Add-eshell-command-result-equal-with-an-ERT-explaine.patch
Description: Text document

Attachment: 0003-Fix-non-interactive-use-of-conditionals-in-Eshell.patch
Description: Text document


reply via email to

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