* fix/ert-multiline-explanation
@ 2015-10-21 20:43 Phillip Lord
2015-10-21 20:47 ` fix/ert-multiline-explanation David Kastrup
2015-10-24 15:11 ` fix/ert-multiline-explanation Eli Zaretskii
0 siblings, 2 replies; 10+ messages in thread
From: Phillip Lord @ 2015-10-21 20:43 UTC (permalink / raw)
To: emacs-devel
I would appreciate feedback on whether the change on
fix/ert-multiline-explanation would be a good one.
At the moment, ert allows you to attach explanation functions to explain
why tests have failed. Unfortunately, these explanations are printed out
using "pp" which escapes new lines. So multiline explanations are,
largely, unreadable.
So this patch ignores the value of pp-escape-newlines and resets it to
nil for the duration.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: fix/ert-multiline-explanation
2015-10-21 20:43 fix/ert-multiline-explanation Phillip Lord
@ 2015-10-21 20:47 ` David Kastrup
2015-10-22 8:44 ` fix/ert-multiline-explanation Phillip Lord
2015-10-24 15:11 ` fix/ert-multiline-explanation Eli Zaretskii
1 sibling, 1 reply; 10+ messages in thread
From: David Kastrup @ 2015-10-21 20:47 UTC (permalink / raw)
To: Phillip Lord; +Cc: emacs-devel
phillip.lord@russet.org.uk (Phillip Lord) writes:
> I would appreciate feedback on whether the change on
> fix/ert-multiline-explanation would be a good one.
>
> At the moment, ert allows you to attach explanation functions to explain
> why tests have failed. Unfortunately, these explanations are printed out
> using "pp" which escapes new lines. So multiline explanations are,
> largely, unreadable.
>
> So this patch ignores the value of pp-escape-newlines and resets it to
> nil for the duration.
This patch?
--
David Kastrup
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: fix/ert-multiline-explanation
2015-10-21 20:43 fix/ert-multiline-explanation Phillip Lord
2015-10-21 20:47 ` fix/ert-multiline-explanation David Kastrup
@ 2015-10-24 15:11 ` Eli Zaretskii
2015-10-26 8:55 ` fix/ert-multiline-explanation Phillip Lord
1 sibling, 1 reply; 10+ messages in thread
From: Eli Zaretskii @ 2015-10-24 15:11 UTC (permalink / raw)
To: Phillip Lord; +Cc: emacs-devel
> From: phillip.lord@russet.org.uk (Phillip Lord)
> Date: Wed, 21 Oct 2015 21:43:14 +0100
>
>
> I would appreciate feedback on whether the change on
> fix/ert-multiline-explanation would be a good one.
>
> At the moment, ert allows you to attach explanation functions to explain
> why tests have failed. Unfortunately, these explanations are printed out
> using "pp" which escapes new lines. So multiline explanations are,
> largely, unreadable.
>
> So this patch ignores the value of pp-escape-newlines and resets it to
> nil for the duration.
Could you please show an example, with and without the changes?
TIA
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: fix/ert-multiline-explanation
2015-10-24 15:11 ` fix/ert-multiline-explanation Eli Zaretskii
@ 2015-10-26 8:55 ` Phillip Lord
2015-10-26 15:57 ` fix/ert-multiline-explanation Eli Zaretskii
0 siblings, 1 reply; 10+ messages in thread
From: Phillip Lord @ 2015-10-26 8:55 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: emacs-devel
Eli Zaretskii <eliz@gnu.org> writes:
>> From: phillip.lord@russet.org.uk (Phillip Lord)
>> Date: Wed, 21 Oct 2015 21:43:14 +0100
>>
>>
>> I would appreciate feedback on whether the change on
>> fix/ert-multiline-explanation would be a good one.
>>
>> At the moment, ert allows you to attach explanation functions to explain
>> why tests have failed. Unfortunately, these explanations are printed out
>> using "pp" which escapes new lines. So multiline explanations are,
>> largely, unreadable.
>>
>> So this patch ignores the value of pp-escape-newlines and resets it to
>> nil for the duration.
>
> Could you please show an example, with and without the changes?
Sure. The following code achieves the same thing with advice.
(defun silly-predicate (x))
(defun silly-explainer (&rest args)
(message "Silly predicate is silly.
I mean, it's in the name, so why are you using it?
It's never going to return a sensible answer.
It is after silly.
^^^^^"))
(put 'silly-predicate
'ert-explainer
'silly-explainer)
(defun sisyphus--ert-pp-with-indentation-and-newline (orig object)
(let ((pp-escape-newlines nil))
(funcall orig object)))
(ert-deftest with ()
(should
(silly-predicate
(advice-add
'ert--pp-with-indentation-and-newline
:around
#'sisyphus--ert-pp-with-indentation-and-newline))))
(ert-deftest without ()
(should
(silly-predicate
(advice-remove
'ert--pp-with-indentation-and-newline
#'sisyphus--ert-pp-with-indentation-and-newline))))
And the output.
F with
(ert-test-failed
((should
(silly-predicate
(advice-add 'ert--pp-with-indentation-and-newline :around #'sisyphus--ert-pp-with-indentation-and-newline)))
:form
(silly-predicate nil)
:value nil :explanation "Silly predicate is silly.
I mean, it's in the name, so why are you using it?
It's never going to return a sensible answer.
It is after silly.
^^^^^"))
F without
(ert-test-failed
((should
(silly-predicate
(advice-remove 'ert--pp-with-indentation-and-newline #'sisyphus--ert-pp-with-indentation-and-newline)))
:form
(silly-predicate nil)
:value nil :explanation "Silly predicate is silly.\nI mean, it's in the name, so why are you using it?\nIt's never going to return a sensible answer.\nIt is after silly.\n ^^^^^"))
The point is with the advice I can use multiline explainers, without it
I can but it's pointless.
The bug fix is not essential -- as I have shown I can advice around it,
for this use case, I am struggling to see a use case for which "\n" is
better than a newline.
Phil
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: fix/ert-multiline-explanation
2015-10-26 8:55 ` fix/ert-multiline-explanation Phillip Lord
@ 2015-10-26 15:57 ` Eli Zaretskii
2015-10-27 12:46 ` fix/ert-multiline-explanation Phillip Lord
0 siblings, 1 reply; 10+ messages in thread
From: Eli Zaretskii @ 2015-10-26 15:57 UTC (permalink / raw)
To: Phillip Lord; +Cc: emacs-devel
> From: phillip.lord@russet.org.uk (Phillip Lord)
> Cc: <emacs-devel@gnu.org>
> Date: Mon, 26 Oct 2015 08:55:12 +0000
>
> F with
> (ert-test-failed
> ((should
> (silly-predicate
> (advice-add 'ert--pp-with-indentation-and-newline :around #'sisyphus--ert-pp-with-indentation-and-newline)))
> :form
> (silly-predicate nil)
> :value nil :explanation "Silly predicate is silly.
> I mean, it's in the name, so why are you using it?
> It's never going to return a sensible answer.
> It is after silly.
> ^^^^^"))
>
> F without
> (ert-test-failed
> ((should
> (silly-predicate
> (advice-remove 'ert--pp-with-indentation-and-newline #'sisyphus--ert-pp-with-indentation-and-newline)))
> :form
> (silly-predicate nil)
> :value nil :explanation "Silly predicate is silly.\nI mean, it's in the name, so why are you using it?\nIt's never going to return a sensible answer.\nIt is after silly.\n ^^^^^"))
Looks like your change is a clear improvement, so please install.
Thanks.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: fix/ert-multiline-explanation
2015-10-26 15:57 ` fix/ert-multiline-explanation Eli Zaretskii
@ 2015-10-27 12:46 ` Phillip Lord
0 siblings, 0 replies; 10+ messages in thread
From: Phillip Lord @ 2015-10-27 12:46 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: emacs-devel
Eli Zaretskii <eliz@gnu.org> writes:
>> F with
>> (ert-test-failed
>> ((should
>> (silly-predicate
>> (advice-add 'ert--pp-with-indentation-and-newline :around #'sisyphus--ert-pp-with-indentation-and-newline)))
>> :form
>> (silly-predicate nil)
>> :value nil :explanation "Silly predicate is silly.
>> I mean, it's in the name, so why are you using it?
>> It's never going to return a sensible answer.
>> It is after silly.
>> ^^^^^"))
>
> Looks like your change is a clear improvement, so please install.
>
All done, thanks for the feedback!
Phil
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2015-10-27 12:46 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-21 20:43 fix/ert-multiline-explanation Phillip Lord
2015-10-21 20:47 ` fix/ert-multiline-explanation David Kastrup
2015-10-22 8:44 ` fix/ert-multiline-explanation Phillip Lord
2015-10-23 9:02 ` fix/ert-multiline-explanation Phillip Lord
2015-10-24 14:45 ` fix/ert-multiline-explanation David Engster
2015-10-26 8:52 ` fix/ert-multiline-explanation Phillip Lord
2015-10-24 15:11 ` fix/ert-multiline-explanation Eli Zaretskii
2015-10-26 8:55 ` fix/ert-multiline-explanation Phillip Lord
2015-10-26 15:57 ` fix/ert-multiline-explanation Eli Zaretskii
2015-10-27 12:46 ` fix/ert-multiline-explanation Phillip Lord
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).