org.apache.regexp

Class 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 $

Authors:
Jonathan Locke
Jon S. Stevens
Michael McCallum

Field Summary

(package private) static String
NEW_LINE
(package private) REDebugCompiler
compiler
(package private) String
expr
(package private) int
failures
(package private) int
n
(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(String s)
Exit with a fatal error.
(package private) void
fail(String s)
Fail with an error.
static void
main(String[] args)
Main program entrypoint.
(package private) void
runAutomatedTests()
Run automated unit test
(package private) void
runAutomatedTests(String testDocument)
Run automated tests in RETest.txt file (from Perl 4.0 test battery)
(package private) void
runInteractiveTests(String expr)
Compile and test matching against a single expression
(package private) void
say(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(String s)
Show a success
static boolean
test(String[] args)
Testing entrypoint.

Field Details

NEW_LINE

(package private) static final String NEW_LINE


compiler

(package private)  REDebugCompiler compiler


expr

(package private)  String expr


failures

(package private)  int failures


n

(package private)  int n


r

(package private)  RE r


re1

(package private)  REProgram re1


re1Instructions

(package private)  char[] re1Instructions


showSuccesses

(package private) static final boolean showSuccesses

Field Value:
false

Constructor Details

RETest

public RETest()
Constructor

Method Details

die

(package private)  void die(String s)
Exit with a fatal error.

Parameters:
s - Last famous words before exiting


fail

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

Parameters:
s - Failure description


main

public static void main(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)


runAutomatedTests

(package private)  void runAutomatedTests()
            throws Exception
Run automated unit test


runAutomatedTests

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


runInteractiveTests

(package private)  void runInteractiveTests(String expr)
Compile and test matching against a single expression

Parameters:
expr - Expression to compile and test


say

(package private)  void say(String s)
Say something to standard out

Parameters:
s - What to say


show

(package private)  void show()
Show an expression


showParens

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

Parameters:
r - Matcher object with results to show


success

(package private)  void success(String s)
Show a success

Parameters:
s - Success story


test

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

Parameters:
args - Command line arguments


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