Re: [groovy-user] Probably a nasty bug in 1.5.7 and 1.6-RC-2
Roshan Dawrani schrieb:
> I tried working on a fix for this issue on 1.5.x and 1.6.x and the fix
> is breaking the following 3 tests, which are anyway running contrary to
> the current understanding of how String to String[] transformation
> should happen:
>
> 1) groovy.GroovyMethodsTest.testStringToList
> * asserts
> * 'hello 10' as String[] == ["h", "e", "l", "l", "o", " ", "1", "0"]
> * "hello ${5 + 5}" as String[] == ["h", "e", "l", "l", "o", " ", "1", "0"]
>
> 2) Groovy1617_Bug.testCoerceStringIntoStringArray()
> * asserts "Groovy" as String[] == ["G","r","o","o","v","y"] as String[]
>
> 3) Groovy1617_Bug.testCoerceGStringIntoStringArray()
> * asserts "$a$b" as String[] == ["G","r","o","o","v","y"] as String[] (a = "Gro", b = "ovy")
>
> So, these tests should also be adjusted according to this new
> understanding of the transformation, right?
hmm... that is asType here, that can behave different. 1617 was about
GString and String behaving equal, not about how they should behave.
Changing the transformation doesn't mean it has to change there too...
I did see it is also used in isCase... and it seems it is not tested..
how should it behave there?
> The change I have done is to DefaultTypeTransformation.asArray(Object
> object, Class type) as below:
>
(Continue reading)