sreedharkesarla / spock

Automatically exported from code.google.com/p/spock
0 stars 0 forks source link

Property access and expression resolution in Unroll description similar to GString #212

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
To get a better feedback, I'd like to use properties of an object from the 
where clause and write GString-like expressions. Example:

@Unroll('checks equals and hashCode of the property #{propertyName} = 
#{object."${property}"}')
def 'test' ...

Original issue reported on code.google.com by mgrys...@gmail.com on 29 Oct 2011 at 2:53

GoogleCodeExporter commented 8 years ago
Are you saying that you want more than what's supported in 
spock-0.5-groovy-1.7? spock-0.6-groovy-1.8-SNAPSHOT already supports full 
GStrings in @Unroll, but some people have complained that it's an incompatible 
change, so we might roll it back for the 0.6 release.

Original comment by pnied...@gmail.com on 29 Oct 2011 at 10:50

GoogleCodeExporter commented 8 years ago
Didn't get any feedback. As I understand it, we already support the requested 
feature.

Original comment by pnied...@gmail.com on 17 Feb 2012 at 3:09

GoogleCodeExporter commented 8 years ago
Does it mean that the upcoming 0.6 release will support full GStrings in 
@Unroll?

Original comment by mgrys...@gmail.com on 18 Feb 2012 at 10:45

GoogleCodeExporter commented 8 years ago
0.6-groovy-1.8-SNAPSHOT has had full support for GStrings for a while. For 0.6 
final we've changed plans a bit, but you can still do:

@Unroll
def "#person.name.toUppercase() is #person.age years old"() { ... }

That is, you can call properties and zero-arg methods. If you need more than 
that, you can always add another data variable:

where:
a << ...
b << ...
c = Math.max(a, b)

Original comment by pnied...@gmail.com on 18 Feb 2012 at 7:54