public class CompilationTestHelper
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static interface |
CompilationTestHelper.Result
A result contains information about various aspects of a compiled piece of code.
|
Constructor and Description |
---|
CompilationTestHelper() |
Modifier and Type | Method and Description |
---|---|
void |
assertCompilesTo(java.lang.CharSequence source,
java.lang.CharSequence expected)
Asserts that the expected code is generated for the given source.
|
void |
compile(java.lang.CharSequence source,
IAcceptor<CompilationTestHelper.Result> acceptor)
Parses, validates and compiles the given source.
|
void |
compile(org.eclipse.emf.ecore.resource.ResourceSet resourceSet,
IAcceptor<CompilationTestHelper.Result> acceptor)
Parses, validates and compiles the given source.
|
void |
configureFreshWorkspace() |
protected java.io.File |
createFreshTempDir() |
protected java.lang.String |
getSourceFolderPath() |
org.eclipse.emf.ecore.resource.ResourceSet |
resourceSet(Pair<java.lang.String,? extends java.lang.CharSequence>... resources)
creates a fresh resource set with the given resources
|
void |
setJavaCompilerClassPath(java.lang.Class<?>... classes) |
org.eclipse.emf.ecore.resource.ResourceSet |
unLoadedResourceSet(Pair<java.lang.String,? extends java.lang.CharSequence>... resources) |
public void setJavaCompilerClassPath(java.lang.Class<?>... classes)
public void configureFreshWorkspace()
protected java.io.File createFreshTempDir()
public void assertCompilesTo(java.lang.CharSequence source, java.lang.CharSequence expected) throws java.io.IOException
source
- some valid source code written in the language under testexpected
- the expected Java source code.java.io.IOException
- if the resource loading failspublic void compile(java.lang.CharSequence source, IAcceptor<CompilationTestHelper.Result> acceptor) throws java.io.IOException
source
- some code written in the language under test.acceptor
- gets called once for each file generated in IGenerator
java.io.IOException
- if the resource loading failsprotected java.lang.String getSourceFolderPath()
public void compile(org.eclipse.emf.ecore.resource.ResourceSet resourceSet, IAcceptor<CompilationTestHelper.Result> acceptor)
resourceSet
- - the ResourceSet
to useacceptor
- gets called once for each file generated in IGenerator
public org.eclipse.emf.ecore.resource.ResourceSet resourceSet(Pair<java.lang.String,? extends java.lang.CharSequence>... resources) throws java.io.IOException
resources
- - pairs of file names and their contentsjava.io.IOException
- if the resource loading failspublic org.eclipse.emf.ecore.resource.ResourceSet unLoadedResourceSet(Pair<java.lang.String,? extends java.lang.CharSequence>... resources) throws java.io.IOException
java.io.IOException