[ https://issues.apache.org/jira/browse/GROOVY-5345?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Pascal Schumacher updated GROOVY-5345: -------------------------------------- Summary: Power assert with unique() gives confusing output (was: Power assert gives confusing output) > Power assert with unique() gives confusing output > ------------------------------------------------- > > Key: GROOVY-5345 > URL: https://issues.apache.org/jira/browse/GROOVY-5345 > Project: Groovy > Issue Type: Bug > Components: Compiler > Affects Versions: 1.8.6 > Environment: Groovy Shell (1.8.6, JVM: 1.7.0_147-icedtea) > Ubuntu 11.11 > Reporter: Volodymyr Sobotovych > Priority: Minor > Attachments: power_assert.groovy > > > Here's a code with a wrong assertion: > {code} > def x = [1, 1, 1] > assert x.unique() == [2] > {code} > And here's the output I get: > {noformat} > wheleph@laptop:~/groovy$ groovy power_assert.groovy > Caught: Assertion failed: > assert x.unique() == [2] > | | | > | [1] false > [1] > Assertion failed: > assert x.unique() == [2] > | | | > | [1] false > [1] > at power_assert.run(power_assert.groovy:2) > {noformat} > While it does state that the assertion failed, the output is confusing > because {{x}} was {{[1, 1, 1]}} at the start of {{x.unique()}}. I guess this > behavior is caused by the fact that {{unique()}} changes the list itself > rather than returns a new instance. -- This message was sent by Atlassian JIRA (v6.3.4#6332)