groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thibault Kruse <tibokr...@googlemail.com>
Subject Re: Should PowerAsserts be more verbose?
Date Tue, 25 Aug 2015 14:07:43 GMT
I don't think that this compromise is easily feasible, nor does this
quite cover the whole problem. The power asserts reveal plenty of
variable state in lengthy expressions. It would be more confusing if
the partial results were non verbose but the end results were verbose.

Example:
groovy:000> assert id([x: id([4, "g"])]) == id([4, id([5: id('a')])])
assert id([x: id([4, "g"])]) == id([4, id([5: id('a')])])
       |      |              |  |      |      |
       |      [4, g]         |  |      [5:a]  a
       [x:[4, g]]            |  [4, [5:a]]
                             false

So I think realistically I can only offer the options of the current
state vs. the verbose (noisy) state.

Note though that the additional type information ('as Set') is
something that could be left out, leaving just improved String
representations (and maybe better Range display).

On Tue, Aug 25, 2015 at 3:41 PM, Jamie Echlin <jamie.echlin@gmail.com> wrote:
> I would like to see type info added if the string representation is the
> same, eg:
>
> assert x == y
>        | |  |
>        | |  [1, 2]
>        | false
>        [1, 2]
>
> is confusing but explained by:
>
> def x = [1, 2]
> def y = [1, 2] as Set
> assert x == y
>
> Adding it at other times might be a bit noisy.
>
> cheers, jamie
>

Mime
View raw message