[ 
https://issues.apache.org/jira/browse/GROOVY-7569?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16143741#comment-16143741
 ] 

Paul King edited comment on GROOVY-7569 at 8/28/17 1:13 PM:
------------------------------------------------------------

Proposed PR applied. Thanks.

Note: this applies just the formatting changes merged as part of GROOVY-7563, 
not all changes discussed during initial discussions. In particular, it 
includes:
* ranges are now in compact format, e.g. 1..5 instead of [1, 2, 3, 4 ,5]
* strings (including within collections printed via Groovy's format methods) 
now are quoted
* special characters like quotes, and \r\n\t are now escaped in strings (see 
above - only strings printed using Groovy's format methods)
* a toString returning null or throwing an exception is detected and provides 
an informative message and the default Object toString
* somewhat safer printing of nested recursive structures

If you want the special quoting and escaping to appear for your own objects you 
can use {{org.codehaus.groovy.runtime.InvokerHelper.format(rawToString, true)}} 
within your toString method.

Other items discussed but NOT considered as part of this issue:
* collections are printed without a type, e.g. [1, 2] as Set; ['foo'] as 
MyCustomList
* two objects with the same toString but different classes aren't 
distinguished, e.g. 'foo' [StringBuilder@38e25e5b] vs 'foo' [Person@1815b417]


was (Author: paulk):
Proposed PR applied. Thanks.

Note: this applies just the formatting changes merged as part of GROOVY-7563, 
not all changes discussed during initial discussions. In particular, it 
includes:
* ranges are now in compact format, e.g. 1..5 instead of [1, 2, 3, 4 ,5]
* strings (including within collections printed via Groovy's format methods) 
now are quoted
* special characters like quotes, and \r\n\t are now escaped in strings (see 
above - only strings printed using Groovy's format methods)
* a toString returning null or throwing an exception is detected and provides 
an informative message and the default Object toString
* somewhat safer printing of nested recursive structures

Other items discussed but NOT considered as part of this issue:
* collections are printed without a type, e.g. [1, 2] as Set; ['foo'] as 
MyCustomList
* two objects with the same toString but different classes aren't 
distinguished, e.g. 'foo' [StringBuilder@38e25e5b] vs 'foo' [Person@1815b417]

> PowerAsserts should print results more verbosely and safer
> ----------------------------------------------------------
>
>                 Key: GROOVY-7569
>                 URL: https://issues.apache.org/jira/browse/GROOVY-7569
>             Project: Groovy
>          Issue Type: Improvement
>            Reporter: Thibault Kruse
>            Assignee: Paul King
>              Labels: breaking
>             Fix For: 2.5.0-beta-2
>
>
> The output of buffer evaluation results in PowerAsserts hides a lot of useful 
> information from the user.
> This is similar to https://issues.apache.org/jira/browse/GROOVY-7568, but 
> independent.
> Discussed here:
> http://groovy.329449.n5.nabble.com/Should-PowerAsserts-be-more-verbose-td5727255.html
> https://groups.google.com/d/msg/spockframework/XbR-McgaAss/-wtkD1X1BAAJ
> In particular Strings are printed without surrounding quotes, collections are 
> printed without telling whether they are Lists, Maps, Sets, or Ranges. Ranges 
> are printed fully as lists (which can be unnecessarily long).
> An implementation is almost done at 
> https://github.com/tkruse/incubator-groovy/tree/pretty
> The downside or more information is that this output could be regarded as 
> "too noisy".



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to