org.apache.regexp
Class RETest

java.lang.Object
  |
  +--org.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,v 1.5 2003/05/02 01:03:47 vgritsenko Exp $
Author:
Jonathan Locke, Jon S. Stevens, Michael McCallum

Field Summary
(package private)  REDebugCompiler compiler
           
(package private)  java.lang.String expr
           
(package private)  int failures
           
(package private)  int n
           
(package private) static java.lang.String NEW_LINE
           
(package private)  RE r
           
(package private)  REProgram re1
           
(package private)  char[] re1Instructions
           
(package private) static boolean showSuccesses
           
 
Constructor Summary
RETest()
          Constructor
 
Method Summary
(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.
static void main(java.lang.String[] args)
          Main program entrypoint.
(package private)  void runAutomatedTests()
          Run automated unit test
(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 show()
          Show an expression
(package private)  void showParens(RE r)
          Dump parenthesized subexpressions found by a regular expression matcher object
(package private)  void success(java.lang.String s)
          Show a success
static boolean test(java.lang.String[] args)
          Testing entrypoint.
 
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

r

RE r

compiler

REDebugCompiler compiler

re1Instructions

char[] re1Instructions

re1

REProgram re1

expr

java.lang.String expr

n

int n

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.

Parameters:
args - Command line arguments (optional regular expression)

test

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

Parameters:
args - Command line arguments
Throws:
java.lang.Exception - thrown in case of error

runInteractiveTests

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

Parameters:
expr - Expression to compile and test

die

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

Parameters:
s - Last famous words before exiting

fail

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

Parameters:
s - Failure description

success

void success(java.lang.String s)
Show a success

Parameters:
s - Success story

say

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

Parameters:
s - What to say

show

void show()
Show an expression


showParens

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

Parameters:
r - Matcher object with results to show

runAutomatedTests

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

Throws:
java.lang.Exception - thrown in case of error

runAutomatedTests

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

Throws:
java.lang.Exception - thrown in case of error


Copyright © 2001-2003 Apache Software Foundation. All Rights Reserved.