aliakhtar / spock

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

Compilation error when using multi assignment #297

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem? If possible, provide source code and
stack trace.
Code 
class EncryptionServiceSpec extends Specification {
def "test decryption of unecnrypted file"(){
    setup: 
        def clearTextFile = new File("test/resources/clearText.txt")
        clearTextFile.write("THIS IS CLEAR TEXT")

    when:
        def (privateKey,publicCert) = service.generateKeyPair("123")
        service.decryptFile(new FileInputStream(clearTextFile), privateKey )

    then:
        clearTextFile.delete()
        thrown GeneralSecurityException
}
}
2.

java.lang.ClassCastException: 
org.codehaus.groovy.ast.expr.ArgumentListExpression cannot be cast to 
org.codehaus.groovy.ast.expr.VariableExpression at 
org.codehaus.groovy.ast.expr.DeclarationExpression.getVariableExpression(Declara
tionExpression.java:103) at 
org.spockframework.compiler.SpecRewriter.moveVariableDeclarations(SpecRewriter.j
ava:538)
3.
When I remove the multi assignment def (privateKey,publicCert) and use a list 
it works fine

What version of Spock and Groovy are you using?
Groovy 1.8 Spock 0.7

Please provide any additional information below. You can also assign
labels.

Original issue reported on code.google.com by nocon...@genospace.com on 7 Feb 2013 at 2:34

GoogleCodeExporter commented 8 years ago
Issue 304 has been merged into this issue.

Original comment by pnied...@gmail.com on 23 Mar 2013 at 9:35

GoogleCodeExporter commented 8 years ago

Original comment by pnied...@gmail.com on 31 Mar 2013 at 8:57