Hi Sebastian,

> now I looked into this and have following idea:

> RETest has a public static method which reads a filename and returns an 
> array of test-objects. An test-object has accessing methods for the 
> contents of the 5 lines for each test.

for now RETest processes script file in the follows way (see 
RETest.runAutomatedTests())

        BufferedReader br = new BufferedReader(new FileReader(testInput));
        try
        {
            // While input is available, parse lines
            while (br.ready())
            {
                Runnable testcase = RETest.getNextTestCase(this, br);
                if (testcase != null) {
                    testcase.run();
                }
            }
        }
        finally
        {
            br.close();
        }

So, RETest.getNextTestCase() is that static method which creates test
cases.  It's possible to change it so it will return array of test
cases, but I'm not sure that we need this (to be discussed :)
Test case is instance of RETestCase, it needs some utility methods
from RETest (we can extract them into public interface which you will
need to implement). Here is a draft of this interface:

interface RETestCaseEnv
{
    void fail(StringBuffer log, String s); // to report failure
    void say(String s);                    // to make some logging
    int getNextTestNo();                   // get number for this testcase
    RECompiler getCompiler();              // compiler to compile pattern
    boolean shouldShowSuccesses();         // should we print parens if match was 
successful
}



> With these objects I would write the JUnit tests and give the source back 
> to you.

I'll try to send diffs tomorrow. So you will be able apply them to
your copy of current regexp workspace and play with it.

> Maybe some convience methods for testing could also be public as well, we 
> could look in this deeper in the next step.

If you find that some methods should be public, just make them
public :)  Although I don't see any such methods for now.

> What do you think about this?

Agree with such approach.

With best regards, Oleg.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to