improved technique to locate files

This commit is contained in:
Oliver Burn 2001-08-30 13:09:57 +00:00
parent f69c785053
commit f34eba11cb
2 changed files with 15 additions and 13 deletions

View File

@ -1,7 +1,3 @@
<!-- ----------------------------------------------------------------- -->
<!-- You will need ANT 1.4Beta1 or greater to be able to run the tests -->
<!-- ----------------------------------------------------------------- -->
<project name="test" default="compile.checkstyle" basedir=".">
<!-- set global properties for this build -->
@ -16,6 +12,7 @@
<!-- distributed jar file. -->
<property name="antlr.home" value="c:/apps/antlr-2.7.1" />
<property name="regexp.jar" value="c:/apps/jakarta-regexp-1.2/jakarta-regexp-1.2.jar" />
<property name="junit.jar" value="c:/apps/junit3.5/junit.jar" />
<property name="checkstyle.dir" value="src/checkstyle/com/puppycrawl/tools/checkstyle" />
<property name="version" value="1.3" />
@ -29,13 +26,16 @@
<path refid="build.classpath" />
</path>
<path id="tests.classpath">
<!-- first entry needed to locate source files -->
<pathelement location="src/tests" />
<pathelement location="classes/tests" />
<path id="tests.buildpath">
<pathelement location="${junit.jar}" />
<path refid="run.classpath" />
</path>
<path id="tests.runpath">
<pathelement location="classes/tests" />
<path refid="tests.buildpath" />
</path>
<target name="display.classpath">
<property name="asd" refid="run.classpath" />
<echo message="Classpath is ${asd}" />
@ -85,7 +85,7 @@
<javac srcdir="src/tests"
destdir="classes/tests"
deprecation="on" debug="on"
classpathref="run.classpath" />
classpathref="tests.buildpath" />
</target>
<!-- -->
@ -145,9 +145,12 @@
</target>
<target name="run.tests" depends="compile.tests">
<junit printsummary="yes">
<property name="tests.dir"
location="src/tests/com/puppycrawl/tools/checkstyle"/>
<junit printsummary="yes" fork="yes">
<jvmarg value="-Dtests.dir=${tests.dir}"/>
<formatter type="plain" />
<classpath refid="tests.classpath"/>
<classpath refid="tests.runpath"/>
<batchtest>
<fileset dir="src/tests">
<include name="**/*Test.java" />

View File

@ -32,8 +32,7 @@ public class CheckerTest
protected String getPath(String aFilename)
throws IOException
{
final URL u = getClass().getResource(".");
final File f = new File(u.getPath(), aFilename);
final File f = new File(System.getProperty("tests.dir"), aFilename);
return f.getCanonicalPath();
}