This is an automated email from the ASF dual-hosted git repository.

paulk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/groovy.git


The following commit(s) were added to refs/heads/master by this push:
     new 86d305b  GROOVY-9010: MissingMethodException during ASTTest annotation 
assert execution
86d305b is described below

commit 86d305b4c6ac8ceff064e6e18ca8161d6c13d4e6
Author: Paul King <pa...@asert.com.au>
AuthorDate: Wed Feb 27 09:06:11 2019 +1000

    GROOVY-9010: MissingMethodException during ASTTest annotation assert 
execution
    
    fix out by one error
---
 .../groovy/transform/ASTTestTransformation.groovy  |  2 +-
 src/test/groovy/bugs/Groovy9010Bug.groovy          | 30 ++++++++++++++++++++++
 2 files changed, 31 insertions(+), 1 deletion(-)

diff --git 
a/src/main/groovy/org/codehaus/groovy/transform/ASTTestTransformation.groovy 
b/src/main/groovy/org/codehaus/groovy/transform/ASTTestTransformation.groovy
index dcfe314..91351a0 100644
--- a/src/main/groovy/org/codehaus/groovy/transform/ASTTestTransformation.groovy
+++ b/src/main/groovy/org/codehaus/groovy/transform/ASTTestTransformation.groovy
@@ -84,7 +84,7 @@ class ASTTestTransformation extends AbstractASTTransformation 
implements Compila
                     for (int i = testClosure.lineNumber; i <= 
testClosure.lastLineNumber; i++) {
                         sb.append(source.source.getLine(i, new 
Janitor())).append('\n')
                     }
-                    def testSource = sb.substring(testClosure.columnNumber + 
1, sb.length())
+                    def testSource = sb.substring(testClosure.columnNumber, 
sb.length())
                     testSource = testSource.substring(0, 
testSource.lastIndexOf('}'))
                     CompilerConfiguration config = new CompilerConfiguration()
                     def customizer = new ImportCustomizer()
diff --git a/src/test/groovy/bugs/Groovy9010Bug.groovy 
b/src/test/groovy/bugs/Groovy9010Bug.groovy
new file mode 100644
index 0000000..d8b7045
--- /dev/null
+++ b/src/test/groovy/bugs/Groovy9010Bug.groovy
@@ -0,0 +1,30 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package groovy.bugs
+
+import gls.CompilableTestSupport
+
+class Groovy9010Bug extends CompilableTestSupport {
+    void testASTTestWithNoSpacesInClosure() {
+        shouldCompile '''
+            @groovy.transform.ASTTest({assert 1==1})
+            def x
+        '''
+    }
+}

Reply via email to