bgarrels / spock

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

Expectations on named parameters not wrapped with Map literal give compilation error #358

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Mocked collaborator. Expectation set on a method with named parameters. Named 
parameters must be wrapped with Map literal (although not required by Groovy). 
If not, compilation error occurs.

Doesn't work:
1 * collaborator.method(param1: 1, param2: 2)

Compilation error compiling [unit] tests: unknown kind of argument list: 
org.codehaus.groovy.ast.expr.TupleExpression@1066d85f[org.codehaus.groovy.ast.ex
pr.NamedArgumentListExpression@50074d62[org.codehaus.groovy.ast.expr.MapEntryExp
ression@f6985fa(key: ConstantExpression[param1], value: ConstantExpression[1]), 
org.codehaus.groovy.ast.expr.MapEntryExpression@58dae7fd(key: 
ConstantExpression[param2], value: ConstantExpression[2])]] (Use --stacktrace 
to see the full trace)

Works:
1 * collaborator.method([param1: 1, param2: 2])

Please see the attached test case for the full source code.

Original issue reported on code.google.com by mgrys...@gmail.com on 7 Apr 2014 at 2:14

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by pnied...@gmail.com on 7 Apr 2014 at 4:24

GoogleCodeExporter commented 9 years ago

Original comment by pnied...@gmail.com on 1 Mar 2015 at 11:45