raven-compiler/src/test/java/org/raven/antlr/RuleTester.java
/**
     * Tests input for syntax errors
     *
     * @param txt The input
     * @param pass Whether there should or shouldn't be syntax errors
     */
Tests input for syntax errors
@param txt The input
@param pass Whether there should or shouldn't be syntax errors
Tests input for syntax errors @param txt The input @param pass Whether there should or shouldn ' t be syntax errors
public static void testSyntax(final String txt, final boolean pass) {
        RavenLexer lexer = new RavenLexer(CharStreams.fromString(txt));
        CommonTokenStream ts = new CommonTokenStream(lexer);
        RavenParser p = new RavenParser(ts);
        p.removeErrorListener(ConsoleErrorListener.INSTANCE);
        try {
            p.ravenFile();
        } catch (Exception ignored) {
            if (pass) {
                Assert.fail();
            } else {
                return;
            }
        }
        if (pass) {
            Assert.assertEquals("Syntax Errors for: " + txt, 0, p.getNumberOfSyntaxErrors());
        } else {
            Assert.assertNotEquals("Expected syntax errors: " + txt, 0, p.getNumberOfSyntaxErrors());
        }
    }
public static void testSyntax ( final String txt , final boolean pass ) { RavenLexer lexer = new RavenLexer ( CharStreams . fromString ( txt ) ) ; CommonTokenStream ts = new CommonTokenStream ( lexer ) ; RavenParser p = new RavenParser ( ts ) ; p . removeErrorListener ( ConsoleErrorListener . INSTANCE ) ; try { p . ravenFile ( ) ; } catch ( Exception ignored ) { if ( pass ) { Assert . fail ( ) ; } else { return ; } } if ( pass ) { Assert . assertEquals ( "Syntax Errors for: " + txt , 0 , p . getNumberOfSyntaxErrors ( ) ) ; } else { Assert . assertNotEquals ( "Expected syntax errors: " + txt , 0 , p . getNumberOfSyntaxErrors ( ) ) ; } }
Tests input for syntax errors
 @param txt The input
 @param pass Whether there should or shouldn't be syntax errors
Tests input for syntax errors @param txt The input @param pass Whether there should or shouldn ' t be syntax errors