Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.apache.regexp
Class RETest  view RETest download RETest.java

java.lang.Object
  extended byorg.apache.regexp.RETest

public class RETest
extends java.lang.Object

Data driven (and optionally interactive) testing harness to exercise regular expression compiler and matching engine.

Version:
$Id: RETest.java 232192 2005-08-12 03:04:07Z vgritsenko $

Field Summary
(package private)  REDebugCompiler compiler
           
(package private)  int failures
           
(package private) static java.lang.String NEW_LINE
           
(package private) static boolean showSuccesses
           
(package private)  int testCount
           
 
Constructor Summary
RETest()
          Constructor
 
Method Summary
 void assertEquals(java.lang.String message, int expected, int actual)
           
 void assertEquals(java.lang.String message, java.lang.String expected, java.lang.String actual)
           
(package private)  void die(java.lang.String s)
          Exit with a fatal error.
(package private)  void fail(java.lang.String s)
          Fail with an error.
(package private)  void fail(java.lang.StringBuffer log, java.lang.String s)
          Fail with an error.
private  java.lang.String findNextTest(java.io.BufferedReader br)
          Finds next test description in a given script.
private  boolean getExpectedResult(java.lang.String yesno)
          Converts yesno string to boolean.
private  RETestCase getNextTestCase(java.io.BufferedReader br)
          Creates testcase for the next test description in the script file.
static void main(java.lang.String[] args)
          Main program entrypoint.
(package private)  void runAutomatedTests(java.lang.String testDocument)
          Run automated tests in RETest.txt file (from Perl 4.0 test battery)
(package private)  void runInteractiveTests(java.lang.String expr)
          Compile and test matching against a single expression
(package private)  void say(java.lang.String s)
          Say something to standard out
(package private)  void showParens(RE r)
          Dump parenthesized subexpressions found by a regular expression matcher object
static boolean test(java.lang.String[] args)
          Testing entrypoint.
(package private)  void testOther()
          Run automated unit test
private  void testPrecompiledRE()
           
private  void testSplitAndGrep()
           
private  void testSubst()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

showSuccesses

static final boolean showSuccesses
See Also:
Constant Field Values

NEW_LINE

static final java.lang.String NEW_LINE

compiler

REDebugCompiler compiler

testCount

int testCount

failures

int failures
Constructor Detail

RETest

public RETest()
Constructor

Method Detail

main

public static void main(java.lang.String[] args)
Main program entrypoint. If an argument is given, it will be compiled and interactive matching will ensue. If no argument is given, the file RETest.txt will be used as automated testing input.


test

public static boolean test(java.lang.String[] args)
                    throws java.lang.Exception
Testing entrypoint.


runInteractiveTests

void runInteractiveTests(java.lang.String expr)
Compile and test matching against a single expression


die

void die(java.lang.String s)
Exit with a fatal error.


fail

void fail(java.lang.StringBuffer log,
          java.lang.String s)
Fail with an error. Will print a big failure message to System.out.


fail

void fail(java.lang.String s)
Fail with an error. Will print a big failure message to System.out.


say

void say(java.lang.String s)
Say something to standard out


showParens

void showParens(RE r)
Dump parenthesized subexpressions found by a regular expression matcher object


runAutomatedTests

void runAutomatedTests(java.lang.String testDocument)
                 throws java.lang.Exception
Run automated tests in RETest.txt file (from Perl 4.0 test battery)


testOther

void testOther()
         throws java.lang.Exception
Run automated unit test


testPrecompiledRE

private void testPrecompiledRE()

testSplitAndGrep

private void testSplitAndGrep()

testSubst

private void testSubst()

assertEquals

public void assertEquals(java.lang.String message,
                         java.lang.String expected,
                         java.lang.String actual)

assertEquals

public void assertEquals(java.lang.String message,
                         int expected,
                         int actual)

getExpectedResult

private boolean getExpectedResult(java.lang.String yesno)
Converts yesno string to boolean.


findNextTest

private java.lang.String findNextTest(java.io.BufferedReader br)
                               throws java.io.IOException
Finds next test description in a given script.


getNextTestCase

private RETestCase getNextTestCase(java.io.BufferedReader br)
                            throws java.io.IOException
Creates testcase for the next test description in the script file.