[ https://issues.apache.org/jira/browse/GROOVY-7569?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14984449#comment-14984449 ]
Thibault Kruse edited comment on GROOVY-7569 at 11/1/15 4:52 PM: ----------------------------------------------------------------- Examples from mailing list: {code} String es = 'a \'b' String ml = 'a\n \'b' StringBuffer b = new StringBuffer('x') def toNull = new Object() {public String toString() {null}} int[] ia = [1, 2, 3, 4] List sl = ['a', 'b'] String[] sa = ['a', 'b'] as String[] Set ss = ['a', 'b'] as Set class Person {String name = "John Doe"; String toString() {name}} Map m = [a: 'b', c: 'd'] assert '' == [es, ml, b, toNull, ia, sl, sa, ss, new Person(), m] // BEFORE assert '' == [es, ml, b, toNull, ia, sl, sa, ss, new Person(), new Car(), m] | | | | | | | | | | | | | a 'b| x | | | | | John Doe | [a:b, c:d] false | | | | | [a, b] Car@47caa0f | | | | [a, b] | | | [a, b] | | [1, 2, 3, 4] | foo$1@1480c116 (toString() == null) a 'b // AFTER assert '' == [es, ml, b, toNull, ia, sl, sa, ss, new Person(), new Car(), m] | | | | | | | | | | | | | | | | | | | | | | | ['a':'b', 'c':'d'] | | | | | | | | | | Car@1815b417 | | | | | | | | | {John Doe} Person@38e25e5b | | | | | | | | ['a', 'b'] as Set | | | | | | | ['a', 'b'] as String[] | | | | | | ['a', 'b'] | | | | | [1, 2, 3, 4] | | | | {toString() == null} foo$1@4b10c0df | | | {x} StringBuffer@38e696f9 | | '''a | | 'b''' | 'a \'b' false {code} was (Author: tkruse): Examples from mailing list: {code} String es = 'a \'b' String ml = 'a\n \'b' StringBuffer b = new StringBuffer('x') def toNull = new Object() {public String toString() {null}} int[] ia = [1, 2, 3, 4] List sl = ['a', 'b'] String[] sa = ['a', 'b'] as String[] Set ss = ['a', 'b'] as Set class Person {String name = "John Doe"; String toString() {name}} Map m = [a: 'b', c: 'd'] assert '' == [es, ml, b, toNull, ia, sl, sa, ss, new Person(), m] assert '' == [es, ml, b, toNull, ia, sl, sa, ss, new Person(), new Car(), m] | | | | | | | | | | | | | a 'b| x | | | | | John Doe | [a:b, c:d] false | | | | | [a, b] Car@47caa0f | | | | [a, b] | | | [a, b] | | [1, 2, 3, 4] | foo$1@1480c116 (toString() == null) a 'b AFTER assert '' == [es, ml, b, toNull, ia, sl, sa, ss, new Person(), new Car(), m] | | | | | | | | | | | | | | | | | | | | | | | ['a':'b', 'c':'d'] | | | | | | | | | | Car@1815b417 | | | | | | | | | {John Doe} Person@38e25e5b | | | | | | | | ['a', 'b'] as Set | | | | | | | ['a', 'b'] as String[] | | | | | | ['a', 'b'] | | | | | [1, 2, 3, 4] | | | | {toString() == null} foo$1@4b10c0df | | | {x} StringBuffer@38e696f9 | | '''a | | 'b''' | 'a \'b' false {code} > 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 > > 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 hyphens, 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.3.4#6332)