> > RE.REPLACE_WITH_ESCAPES could not be resolved. Please send me your new
> > RE.java. Easiest for me would be, if you send all your source files
>
> This is part of the fix which is not integrated yet, so you can just
> remove/comment out
> tests which use this flag.
Yes, I did that. I have still problems running the tests and I didn't look
in this deeper yet.
> > Using JUnit the way you described is easy.
Thanks for your good support here.
> > I had MUCH more time to spend
> > to get the source files. If the test works, I will refactor a little
and
> >would like to discuss it with you.
>
> I'm sorry for that.
Well, that is my fault to spend much time to get the source files. I am
still a newbie with this handling.
Now I would like to discuss the interface to junit, for the tests. If you
give me your complete source code, I could implement it and give it back
to you.
------------------------------------------------------------------------------
How about a default implementation of the interface RETestCaseEnv? Maybe
the naming could be better.
public class RETestCaseEnvImpl implements RETestCaseEnv
{
/**
* number in automated test
*/
private int testCount = 0; // public getTestNo() is needed
???
public int getNextTestNo()
{
return ++this.testCount;
}
public void fail(StringBuffer log, String s)
{
System.out.print(log.toString());
}
public RECompiler getCompiler()
{
return new RECompiler();
}
public void say(String s)
{
System.out.println(s);
}
public boolean shouldShowSuccesses()
{
return false;
}
}
Than for JUnit (in the first step) I only need:
import junit.framework.TestCase;
import org.apache.regexp.RETestCaseEnvImpl;
public class JUnitEnv extends RETestCaseEnvImpl
{
public void fail(StringBuffer log, String string)
{
super.fail(log, string);
TestCase.fail(string);
}
}
With this solution a little refactor for RETest could be done. The Env
could be held as instance varaiable and the testCount could be accessed
through the Env.
For running the TestCases with JUnit:
public class RETestJUnit extends TestCase
{
public void test() throws FileNotFoundException, IOException
{
this.testFilename("docs/RETest.txt");
}
public void testFilename(String testInput)
throws FileNotFoundException, IOException
{
BufferedReader br = new BufferedReader(new
FileReader(testInput));
try
{
// While input is available, parse lines
while (br.ready())
{
Runnable testcase =
RETest.getNextTestCase(new JUnitEnv(), br);
if (testcase != null) {
testcase.run();
}
}
}
finally
{
br.close();
}
}
}
How about refactoring RETest in this way, that there is a public method
which has a filename and an Env as Argument? Than reading this file could
be done in RETest and this class could be more lighter.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]