all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* 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:47 ` fix/ert-multiline-explanation David Kastrup
@ 2015-10-22  8:44   ` Phillip Lord
  2015-10-23  9:02     ` fix/ert-multiline-explanation Phillip Lord
  0 siblings, 1 reply; 10+ messages in thread
From: Phillip Lord @ 2015-10-22  8:44 UTC (permalink / raw)
  To: David Kastrup; +Cc: emacs-devel

David Kastrup <dak@gnu.org> writes:

> 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?

On the branch fix/ert-multiline-explanation. 

a23aa4c9c99147bd6f36941fbae3a2d94c481bed

http://git.savannah.gnu.org/cgit/emacs.git/commit/?h=fix/ert-multiline-explanation&id=a23aa4c9c99147bd6f36941fbae3a2d94c481bed

Never really understood patches. Branches or request pull/pull
request/merge request seem much easier.

Phil



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: fix/ert-multiline-explanation
  2015-10-22  8:44   ` fix/ert-multiline-explanation Phillip Lord
@ 2015-10-23  9:02     ` Phillip Lord
  2015-10-24 14:45       ` fix/ert-multiline-explanation David Engster
  0 siblings, 1 reply; 10+ messages in thread
From: Phillip Lord @ 2015-10-23  9:02 UTC (permalink / raw)
  To: David Kastrup; +Cc: emacs-devel

Phillip Lord <phillip.lord@russet.org.uk> writes:

> David Kastrup <dak@gnu.org> writes:
>
>> 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?
>
> On the branch fix/ert-multiline-explanation. 
>
> a23aa4c9c99147bd6f36941fbae3a2d94c481bed
>
> http://git.savannah.gnu.org/cgit/emacs.git/commit/?h=fix/ert-multiline-explanation&id=a23aa4c9c99147bd6f36941fbae3a2d94c481bed
>
> Never really understood patches. Branches or request pull/pull
> request/merge request seem much easier.

Any comments?

Phil



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: fix/ert-multiline-explanation
  2015-10-23  9:02     ` fix/ert-multiline-explanation Phillip Lord
@ 2015-10-24 14:45       ` David Engster
  2015-10-26  8:52         ` fix/ert-multiline-explanation Phillip Lord
  0 siblings, 1 reply; 10+ messages in thread
From: David Engster @ 2015-10-24 14:45 UTC (permalink / raw)
  To: Phillip Lord; +Cc: emacs-devel

Phillip Lord writes:
>>>> I would appreciate feedback on whether the change on
>>>> fix/ert-multiline-explanation would be a good one.

> Any comments?

I would definitely be in favor of that change. The backtraces in its
current form are pretty much unreadable.

-David



^ 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 14:45       ` fix/ert-multiline-explanation David Engster
@ 2015-10-26  8:52         ` Phillip Lord
  0 siblings, 0 replies; 10+ messages in thread
From: Phillip Lord @ 2015-10-26  8:52 UTC (permalink / raw)
  To: David Engster; +Cc: emacs-devel

David Engster <deng@randomsample.de> writes:

> Phillip Lord writes:
>>>>> I would appreciate feedback on whether the change on
>>>>> fix/ert-multiline-explanation would be a good one.
>
>> Any comments?
>
> I would definitely be in favor of that change. The backtraces in its
> current form are pretty much unreadable.


It doesn't change the backtraces AFAICT.

Phil



^ 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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.