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

Daniel Sun reassigned GROOVY-5079:
----------------------------------

    Fix Version/s: 7.0.0-alpha-1
         Assignee: Daniel Sun

> Groovy assert displays wrong original statement if error message is specified
> -----------------------------------------------------------------------------
>
>                 Key: GROOVY-5079
>                 URL: https://issues.apache.org/jira/browse/GROOVY-5079
>             Project: Groovy
>          Issue Type: Bug
>          Components: groovy-runtime
>    Affects Versions: 1.8.2
>            Reporter: Evgeny Goldin
>            Assignee: Daniel Sun
>            Priority: Major
>             Fix For: 7.0.0-alpha-1
>
>
> {code}
> def files          = []
> def failIfNotFound = true
> assert ( files || ( ! failIfNotFound )), "Error message"
> {code}
> causes
> {code}
> Exception thrown
> java.lang.AssertionError: Error message. Expression: (files || 
> failIfNotFound). Values: files = [], failIfNotFound = true
>       at 
> org.codehaus.groovy.runtime.InvokerHelper.assertFailed(InvokerHelper.java:388)
> {code}
> to be thrown. Note how {{"( ! failIfNotFound )"}} in the original statement 
> became just {{"failIfNotFound"}} in the error message.
> Without specifying error message it works as expected:
> {code}
> def files          = []
> def failIfNotFound = true
> assert ( files || ( ! failIfNotFound ))
> Exception thrown
> Assertion failed: 
> assert ( files || ( ! failIfNotFound ))
>          |     |  |   |
>          []    |  |   true
>                |  false
>                false
> {code}



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to