|
Groovy example source code file (AstBuilderFromCodePackageImportTest.groovy)
The Groovy AstBuilderFromCodePackageImportTest.groovy source code
package org.codehaus.groovy.ast.builder.testpackage
import org.codehaus.groovy.ast.builder.*
import org.codehaus.groovy.runtime.MethodClosure
/**
* Test package imports in AstBuilder.
*
* It is important that this class contains an import of builder.* and not
* the AstBuilder class individually.
*
* @author Hamlet D'Arcy
*/
@WithAstBuilder
public class AstBuilderFromCodePackageImportTest extends GroovyTestCase {
public void testPackageImport() {
def expected = new AstBuilder().buildFromString(""" println "Hello World" """)
def result = new AstBuilder().buildFromCode {
println "Hello World"
}
AstAssert.assertSyntaxTree(expected, result)
}
}
Other Groovy examples (source code examples)Here is a short list of links related to this Groovy AstBuilderFromCodePackageImportTest.groovy source code file: |
Other websites by Alvin Alexander:
Life/living in Alaska (OneMansAlaska.com)
How I Sold My Business (HowISoldMyBusiness.com)
Copyright 1998-2011 Alvin Alexander, devdaily.com
All Rights Reserved.