From: Ihor Radchenko <yantar92@gmail.com>
To: Max Nikulin <manikulin@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: [PATCH] make test: Make failure results more verbose
Date: Fri, 21 Jan 2022 21:33:10 +0800 [thread overview]
Message-ID: <87h79xz015.fsf@localhost> (raw)
In-Reply-To: <sruqvj$s3k$1@ciao.gmane.io>
[-- Attachment #1: Type: text/plain, Size: 368 bytes --]
Max Nikulin <manikulin@gmail.com> writes:
> I am attaching a tentative patch for Org that should make
> EMACS_TEST_VERBOSE setting more transparent.
Thanks! Your patch looks cleaner.
In addition, I am attaching a tentative hack to make ERT pretty-print
the failure reason as you wished. WDYT?
Though it may also be something to consider in Emacs core.
Best,
Ihor
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-make-test-Pretty-print-failure-reason-in-test-summar.patch --]
[-- Type: text/x-patch, Size: 1745 bytes --]
From 1a8520b9cb2883672b1a6d2385d539a158658890 Mon Sep 17 00:00:00 2001
Message-Id: <1a8520b9cb2883672b1a6d2385d539a158658890.1642771846.git.yantar92@gmail.com>
From: Ihor Radchenko <yantar92@gmail.com>
Date: Fri, 21 Jan 2022 21:30:21 +0800
Subject: [PATCH] make test: Pretty print failure reason in test summary
---
testing/org-test.el | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/testing/org-test.el b/testing/org-test.el
index 0f1e254aa..a00007b6b 100644
--- a/testing/org-test.el
+++ b/testing/org-test.el
@@ -344,6 +344,13 @@ (defun org-test-strip-text-props (s)
(let ((noprop (copy-sequence s)))
(set-text-properties 0 (length noprop) nil noprop)
noprop))
+
+(require 'cl-macs)
+(defun org-test-ert-reason-for-test-result:pretty-func (func result)
+ "Call `ert-reason-for-test-result' (as FUNC(RESULT)).
+Pretty-print the failure reason."
+ (cl-letf (((symbol-function 'format) (lambda (_ reason) (concat "\n" (pp-to-string reason)))))
+ (funcall func result)))
\f
(defun org-test-string-exact-match (regex string &optional start)
@@ -435,7 +442,11 @@ (defun org-test-run-batch-tests (&optional org-test-selector)
(org-test-update-id-locations)
(org-test-load)
(message "selected tests: %s" org-test-selector)
- (ert-run-tests-batch-and-exit org-test-selector)))
+ (advice-add 'ert-reason-for-test-result :around
+ #'org-test-ert-reason-for-test-result:pretty-func)
+ (ert-run-tests-batch-and-exit org-test-selector)
+ (advice-remove 'ert-reason-for-test-result
+ #'org-test-ert-reason-for-test-result:pretty-func)))
(defun org-test-run-all-tests ()
"Run all defined tests matching \"\\(org\\|ob\\)\".
--
2.34.1
next prev parent reply other threads:[~2022-01-21 14:26 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-02 13:12 [PATCH] make test: Make failure results more verbose Ihor Radchenko
2022-01-03 5:35 ` Max Nikulin
2022-01-07 15:04 ` Ihor Radchenko
2022-01-11 16:46 ` Max Nikulin
2022-01-15 12:52 ` Max Nikulin
2022-01-15 13:06 ` Max Nikulin
2022-01-15 15:58 ` Max Nikulin
2022-01-21 13:33 ` Ihor Radchenko [this message]
2022-01-21 15:01 ` Max Nikulin
2022-01-23 13:31 ` Ihor Radchenko
2022-01-21 13:31 ` Ihor Radchenko
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.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87h79xz015.fsf@localhost \
--to=yantar92@gmail.com \
--cc=emacs-orgmode@gnu.org \
--cc=manikulin@gmail.com \
/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/org-mode.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).