You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by su...@apache.org on 2018/12/29 14:13:03 UTC
[groovy] 10/28: build tweak: move test to use a slightly earlier
phase to avoid stray class files from being produced
This is an automated email from the ASF dual-hosted git repository.
sunlan pushed a commit to branch refine-groovydoc
in repository https://gitbox.apache.org/repos/asf/groovy.git
commit 008509fb0f8600c4a0c094424cd913cd973245cb
Author: Paul King <pa...@asert.com.au>
AuthorDate: Tue Dec 18 16:46:38 2018 +1000
build tweak: move test to use a slightly earlier phase to avoid stray class files from being produced
---
.../org/codehaus/groovy/macro/MacroTest.groovy | 37 +++++++++-------------
1 file changed, 15 insertions(+), 22 deletions(-)
diff --git a/subprojects/groovy-macro/src/test/groovy/org/codehaus/groovy/macro/MacroTest.groovy b/subprojects/groovy-macro/src/test/groovy/org/codehaus/groovy/macro/MacroTest.groovy
index a091335..e3bade5 100644
--- a/subprojects/groovy-macro/src/test/groovy/org/codehaus/groovy/macro/MacroTest.groovy
+++ b/subprojects/groovy-macro/src/test/groovy/org/codehaus/groovy/macro/MacroTest.groovy
@@ -18,8 +18,8 @@
*/
package org.codehaus.groovy.macro
-import groovy.transform.CompileStatic;
-import org.codehaus.groovy.runtime.metaclass.MethodSelectionException;
+import groovy.transform.CompileStatic
+import org.codehaus.groovy.runtime.metaclass.MethodSelectionException
/**
*
@@ -120,41 +120,34 @@ class MacroTest extends GroovyTestCase {
void testCompilePhase() {
assertScript '''
- import org.codehaus.groovy.ast.expr.*;
- import org.codehaus.groovy.ast.stmt.*;
- import org.codehaus.groovy.ast.ClassHelper;
- import org.codehaus.groovy.ast.builder.AstAssert;
- import org.codehaus.groovy.control.CompilePhase;
+ import org.codehaus.groovy.ast.builder.AstAssert
+ import org.codehaus.groovy.control.CompilePhase
- import static org.codehaus.groovy.ast.tools.GeneralUtils.*;
+ import static org.codehaus.groovy.ast.tools.GeneralUtils.*
-
- def result = macro(CompilePhase.FINALIZATION) {
+ def result = macro(CompilePhase.CLASS_GENERATION) {
println "foo"
println "bar"
}
def expected = block(
stmt(callThisX("println", args(constX("foo")))),
- // In FINALIZATION phase last println will be ReturnStatement
+ // by end of CLASS_GENERATION phase last println will be ReturnStatement
returnS(callThisX("println", args(constX("bar")))),
)
- AstAssert.assertSyntaxTree([expected], [result]);
-'''
+ AstAssert.assertSyntaxTree([expected], [result])
+ '''
}
void testAsIsWithCompilePhase() {
assertScript '''
- import org.codehaus.groovy.ast.expr.*;
- import org.codehaus.groovy.ast.stmt.*;
- import org.codehaus.groovy.ast.ClassHelper;
- import org.codehaus.groovy.ast.builder.AstAssert;
- import org.codehaus.groovy.control.CompilePhase;
+ import org.codehaus.groovy.ast.builder.AstAssert
+ import org.codehaus.groovy.control.CompilePhase
- import static org.codehaus.groovy.ast.tools.GeneralUtils.*;
+ import static org.codehaus.groovy.ast.tools.GeneralUtils.*
- def result = macro(CompilePhase.FINALIZATION, true) {
+ def result = macro(CompilePhase.CLASS_GENERATION, true) {
println "foo"
}
@@ -162,8 +155,8 @@ class MacroTest extends GroovyTestCase {
returnS(callThisX("println", args(constX("foo"))))
)
- AstAssert.assertSyntaxTree([expected], [result]);
-'''
+ AstAssert.assertSyntaxTree([expected], [result])
+ '''
}
void testCompileStatic() {