[Groovy] Class TransformTestHelper
- org.codehaus.groovy.tools.ast.TransformTestHelper
class TransformTestHelper extends Object
This TestHarness exists so that a global transform can be run without using the Jar services mechanism, which requires building a jar. To use this simply create an instance of TransformTestHelper with an ASTTransformation and CompilePhase, then invoke parse(File) or parse(String). This test harness is not exactly the same as executing a global transformation but can greatly aide in debugging and testing a transform. You should still test your global transformation when packaged as a jar service before releasing it.
Constructor Summary
Constructor and description |
---|
TransformTestHelper
(ASTTransformation transform, CompilePhase phase) Creates the test helper. |
Methods Summary
Type Params | Return Type | Name and description |
---|---|---|
Class |
parse(File input) Compiles the File into a Class applying the transform specified in the constructor. | |
Class |
parse(String input) Compiles the String into a Class applying the transform specified in the constructor. |
Inherited Methods Summary
Methods inherited from class | Name |
---|---|
class Object | wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll |
Constructor Detail
TransformTestHelper(ASTTransformation transform, CompilePhase phase)
Creates the test helper.
- Parameters:
-
transform
- the transform to run when compiling the file later -
phase
- the phase to run the transform in
Method Detail
Class parse(File input)
Compiles the File into a Class applying the transform specified in the constructor.
- input:
- input* must be a groovy source file
Class parse(String input)
Compiles the String into a Class applying the transform specified in the constructor.
- input:
- input* must be a valid groovy source string
© 2003-2020 The Apache Software Foundation
Licensed under the Apache license.
https://docs.groovy-lang.org/3.0.7/html/gapi/org/codehaus/groovy/tools/ast/TransformTestHelper.html