You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Pascal Schumacher (JIRA)" <ji...@apache.org> on 2015/10/15 10:01:05 UTC

[jira] [Updated] (GROOVY-4520) Groovy power assert is confusing if no types are displayed

     [ https://issues.apache.org/jira/browse/GROOVY-4520?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Pascal Schumacher updated GROOVY-4520:
--------------------------------------
    Fix Version/s:     (was: 2.x)

> Groovy power assert is confusing if no types are displayed
> ----------------------------------------------------------
>
>                 Key: GROOVY-4520
>                 URL: https://issues.apache.org/jira/browse/GROOVY-4520
>             Project: Groovy
>          Issue Type: Improvement
>          Components: groovy-runtime
>    Affects Versions: 1.7.5
>            Reporter: Evgeny Goldin
>
> In the following code
> {code}
> def j = "5"
> assert 5 == j
> Assertion failed: 
> assert 5 == j
>          |  |
>          |  5
>          false
> {code}
> it is confusing to understand why assert fails if no types are displayed. Variables compared may be different but their toString() representations used by assert error message may be identical.
> Another example I had was:
> {code}
> assert pomSize == project.properties.pomSize
>        |       |  |       |          |
>        2607    |  |       |          2607
>                |  |       [pomSize:2607, gmavenVersion:1.3]
>                |  MavenProject: com.goldin:groovymag.listing-1:12.2010 @ E:\Projects\GroovyMag\December-2010\Listing-1\pom.xml
>                false
> {code}
> Here I had a number *{{2607}}* on the left, but a String *{{"2607"}}* on the right.
> I suggest to add types of variables compared in assert.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)