FileDocCategorySizeDatePackage
ANTLRTest.javaAPI DocApache Ant 1.705147Wed Dec 13 06:16:24 GMT 2006org.apache.tools.ant.taskdefs.optional

ANTLRTest

public class ANTLRTest extends org.apache.tools.ant.BuildFileTest
If you want to run tests, it is highly recommended to download ANTLR (www.antlr.org), build the 'antlrall.jar' jar with make antlr-all.jar and drop the jar (about 300KB) into Ant lib. - Running w/ the default antlr.jar (70KB) does not work (missing class) Unless of course you specify the ANTLR classpath in your system classpath. (see ANTLR install.html)

Fields Summary
private static final String
TASKDEFS_DIR
Constructors Summary
public ANTLRTest(String name)


       
        super(name);
    
Methods Summary
public voidsetUp()

        configureProject(TASKDEFS_DIR + "antlr.xml");
    
public voidtearDown()

        executeTarget("cleanup");
    
public voidtest1()

        expectBuildException("test1", "required argument, target, missing");
    
public voidtest10()
This test creates an html-ized version of the calculator grammar. The sanity check is simply whether or not an html file was generated.

        executeTarget("test10");
        File outputDirectory = new File(System.getProperty("root"), TASKDEFS_DIR + "antlr.tmp");
        String[] calcFiles = outputDirectory.list(new HTMLFilter());
        assertTrue(calcFiles.length > 0);
    
public voidtest11()
This is just a quick sanity check to run the diagnostic option and make sure that it doesn't throw any funny exceptions.

        executeTarget("test11");
    
public voidtest12()
This is just a quick sanity check to run the trace option and make sure that it doesn't throw any funny exceptions.

        executeTarget("test12");
    
public voidtest13()
This is just a quick sanity check to run all the rest of the trace options (traceLexer, traceParser, and traceTreeWalker) to make sure that they don't throw any funny exceptions.

        executeTarget("test13");
    
public voidtest2()

        expectBuildException("test2", "Invalid output directory");
    
public voidtest3()

        executeTarget("test3");
    
public voidtest4()

        executeTarget("test4");
    
public voidtest5()

        // should print "panic: Cannot find importVocab file 'JavaTokenTypes.txt'"
        // since it needs to run java.g first before java.tree.g
        expectBuildException("test5", "ANTLR returned: 1");
    
public voidtest6()

        executeTarget("test6");
    
public voidtest7()

        expectBuildException("test7", "Unable to determine generated class");
    
public voidtest8()
This is a negative test for the super grammar (glib) option.

        expectBuildException("test8", "Invalid super grammar file");
    
public voidtest9()
This is a positive test for the super grammar (glib) option. ANTLR will throw an error if everything is not correct.

        executeTarget("test9");
    
public voidtestNoRecompile()

        executeTarget("test9");
        assertEquals(-1, getFullLog().indexOf("Skipped grammar file."));
        executeTarget("noRecompile");
        assertTrue(-1 != getFullLog().indexOf("Skipped grammar file."));
    
public voidtestNormalRecompile()

        executeTarget("test9");
        assertEquals(-1, getFullLog().indexOf("Skipped grammar file."));
        executeTarget("normalRecompile");
        assertEquals(-1, getFullLog().indexOf("Skipped grammar file."));
    
public voidtestSupergrammarChangeRecompile()

        executeTarget("test9");
        assertEquals(-1, getFullLog().indexOf("Skipped grammar file."));
        executeTarget("supergrammarChangeRecompile");
        assertEquals(-1, getFullLog().indexOf("Skipped grammar file."));