groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thibault Kruse <>
Subject Re: Should PowerAsserts be more verbose?
Date Tue, 25 Aug 2015 19:48:44 GMT
I had not considered the case of other classes and their toString() method.
And indeed I think it might also be good to output the class and
hashId in addition to toString in such cases. Like this:

assert new Foo() == "aa"
       |         |
       |        false

In that case I would also not escape the output of toString().

I will try out several variants, I am not yet sure about the best way
to print Objects.

On Tue, Aug 25, 2015 at 8:58 PM, Jamie Echlin <> wrote:
> Fair enough. Maybe I have a better real-world example that seems to trip up
> people that I "know":
> class Foo { String toString() {"aa"} }
> assert new Foo() == "aa"
> assert new Foo() == "aa"
>        |         |
>        aa        false
> Taking your proposal, '"aa" as Foo' is not valid, so I'd rather see output
> like '"aa" (Foo)'. But that would be noisy, so ideally I'd like to see that
> only if the output is counter-intuitive, although clearly I have no idea if
> that's feasible.
> I think I disagree that the format for the entire results need be the same
> as that for partial results.
> In the example above, better formatting for strings would possibly make it
> even less intuitive.

View raw message