org.stringtemplate.v4.test
Class BaseTest

java.lang.Object
  extended by org.stringtemplate.v4.test.BaseTest
Direct Known Subclasses:
TestAggregates, TestBuggyDefaultValueRaisesNPETest, TestCompiler, TestCoreBasics, TestDebugEvents, TestDictionaries, TestDollarDelimiters, TestEarlyEvaluation, TestFunctions, TestGroups, TestGroupSyntax, TestGroupSyntaxErrors, TestImports, TestIndentation, TestIndirectionAndEarlyEval, TestInterptimeErrors, TestLexer, TestLineWrap, TestLists, TestModelAdaptors, TestNoNewlineTemplates, TestNullAndEmptyValues, TestOptions, TestRegions, TestRenderers, TestScopes, TestSubtemplates, TestSyntaxErrors, TestTemplateNames, TestTokensForDollarDelimiters, TestWhitespace

public abstract class BaseTest
extends java.lang.Object


Nested Class Summary
static class BaseTest.HashableUser
           
static class BaseTest.StreamVacuum
           
static class BaseTest.User
           
 
Field Summary
static java.lang.String CLASSPATH
           
static java.lang.String newline
           
static java.lang.String pathSep
           
static java.lang.String SUREFIRE_CLASSPATH
          When runnning from Maven, the junit tests are run via the surefire plugin.
static java.lang.String tmpdir
           
 
Constructor Summary
BaseTest()
           
 
Method Summary
 void checkTokens(java.lang.String template, java.lang.String expected)
           
 void checkTokens(java.lang.String template, java.lang.String expected, char delimiterStartChar, char delimiterStopChar)
           
 void compile(java.lang.String fileName, java.lang.String workingDirName)
           
static void deleteFile(java.io.File file)
          Removes the specified file or directory, and all subdirectories.
static void deleteFile(java.lang.String file)
          see deleteFile(File)
 java.lang.String exec(java.lang.String[] args, java.lang.String[] envp, java.lang.String workingDirName)
           
static java.lang.String getRandomDir()
           
 void jar(java.lang.String fileName, java.lang.String[] files, java.lang.String workingDirName)
           
 java.lang.String java(java.lang.String mainClassName, java.lang.String extraCLASSPATH, java.lang.String workingDirName)
           
 void setUp()
           
static void writeFile(java.lang.String dir, java.lang.String fileName, java.lang.String content)
           
 void writeTestFile(java.lang.String main, java.lang.String dirName)
          Creates a file "Test.java" in the directory dirName containing a main method with content starting as given by main.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

pathSep

public static final java.lang.String pathSep

tmpdir

public static final java.lang.String tmpdir

newline

public static final java.lang.String newline

SUREFIRE_CLASSPATH

public static final java.lang.String SUREFIRE_CLASSPATH
When runnning from Maven, the junit tests are run via the surefire plugin. It sets the classpath for the test environment into the following property. We need to pick this up for the junit tests that are going to generate and try to run code.


CLASSPATH

public static final java.lang.String CLASSPATH
Constructor Detail

BaseTest

public BaseTest()
Method Detail

setUp

public void setUp()

writeTestFile

public void writeTestFile(java.lang.String main,
                          java.lang.String dirName)
Creates a file "Test.java" in the directory dirName containing a main method with content starting as given by main.

The value of a variable 'result' defined in 'main' is written to System.out, followed by a newline character.

The final newline character is just the '\n' character, not the system specific line separator (newline).

Parameters:
main -
dirName -

java

public java.lang.String java(java.lang.String mainClassName,
                             java.lang.String extraCLASSPATH,
                             java.lang.String workingDirName)

jar

public void jar(java.lang.String fileName,
                java.lang.String[] files,
                java.lang.String workingDirName)

compile

public void compile(java.lang.String fileName,
                    java.lang.String workingDirName)

exec

public java.lang.String exec(java.lang.String[] args,
                             java.lang.String[] envp,
                             java.lang.String workingDirName)

writeFile

public static void writeFile(java.lang.String dir,
                             java.lang.String fileName,
                             java.lang.String content)

checkTokens

public void checkTokens(java.lang.String template,
                        java.lang.String expected)

checkTokens

public void checkTokens(java.lang.String template,
                        java.lang.String expected,
                        char delimiterStartChar,
                        char delimiterStopChar)

getRandomDir

public static java.lang.String getRandomDir()

deleteFile

public static void deleteFile(java.io.File file)
Removes the specified file or directory, and all subdirectories. Nothing if the file does not exists.

Parameters:
file -

deleteFile

public static void deleteFile(java.lang.String file)
see deleteFile(File)

Parameters:
file -