[Groovy] Class TransformTestHelper

  • org.codehaus.groovy.tools.ast.TransformTestHelper

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

Constructors
Constructor and description
TransformTestHelper (ASTTransformation transform, CompilePhase phase)
Creates the test helper.

Methods Summary

Methods
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

Inherited Methods
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/2.5.14/html/gapi/org/codehaus/groovy/tools/ast/TransformTestHelper.html