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 2016/03/08 20:37:40 UTC

[jira] [Closed] (GROOVY-2330) GString vs String equality in collections

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

Pascal Schumacher closed GROOVY-2330.
-------------------------------------
    Resolution: Fixed

Close after reading Jochens comments.

> GString vs String equality in collections
> -----------------------------------------
>
>                 Key: GROOVY-2330
>                 URL: https://issues.apache.org/jira/browse/GROOVY-2330
>             Project: Groovy
>          Issue Type: Sub-task
>          Components: groovy-runtime
>    Affects Versions: 1.1-rc-3
>            Reporter: Hans Dockter
>
> GStrings are one of the big groovy features. But there current equals behavior in collections makes them useless for many use cases. Very confusing is also the behavioral difference between lists and other collections.
> All tests fail except the first one. (Tests run against rev 9408)
> {code}
> class StringVersusGStringEqualsInCollections extends GroovyTestCase {
>     String string
>     GString gString
>     void setUp() {
>         def g = 'g'
>         string = 'groovy'
>         gString = "${g}roovy"
>     }
>     void testEqualsInList() {
>         assertEquals([string], [gString])
>     }
>     void testEqualsInSet() {
>         assertEquals([string] as Set, [gString] as Set)
>     }
>     void testKeyEqualsInMap() {
>         String someValue = 'somevalue'
>         Map stringMap = [(string): someValue]
>         Map gStringMap = [(gString): someValue]
>         assertEquals(stringMap, gStringMap)
>     }
>     void testValueEqualsInMap() {
>         String someKey = 'somekey'
>         Map stringMap = [(someKey): string]
>         Map gStringMap = [(someKey): gString]
>         assertEquals(stringMap, gStringMap)
>     }
> }
> {code}



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