[PATCH] Some BCEL unit tests
Thomas Hawtin <[email protected]>
| Newsgroups | gmane.comp.jakarta.bcel.devel |
|---|---|
| Message-ID | <[email protected]> |
Attached are patches for some random unit tests I've written for BCEL. The text file is a patch for build.xml and default.properties. The zip is the test source code which should be placed in a directory src/test within BCEL. I wrote the tests as part of removing the dependencies on static variables within BCEL. Having to mess about with class loaders just to use BCEL is not my idea of fun (okay, so neither is writing tests). I'll post a patch for that and to make the attached tests pass as soon as I can work out how... Hope you like it, Tom Hawtin -- http://www.tackline.demon.co.uk/ Unemployed Java Developer of Central London. --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
bcel-unittest-patch.txt
(text/plain, 2.6 KB)
--- /home/tackline/jakarta/jakarta-bcel/build.xml Thu Apr 18 07:52:13 2002
+++ build.xml Sat Apr 19 18:25:45 2003
@@ -41,12 +41,14 @@
<property name="name" value="bcel"/>
<property name="packages" value="org.apache.bcel.*"/>
<property name="src.dir" value="${basedir}/src/java"/>
+ <property name="unittest.dir" value="${basedir}/src/test"/>
<property name="build.dir" value="${basedir}/bin"/>
<property name="examples.dir" value="${basedir}/examples"/>
<property name="mini.dir" value="${examples.dir}/Mini"/>
<property name="docs.dir" value="${basedir}/docs"/>
<property name="apidocs.dir" value="${docs.dir}/api"/>
<property name="build.dest" value="${build.dir}/classes"/>
+ <property name="build.unittest" value="${build.dir}/unittestclasses"/>
<property name="lib.dir" value="${basedir}/lib"/>
<property name="class.path" value="${lib.dir}/Regex.jar:${build.dest}"/>
@@ -72,6 +74,34 @@
includes="org/**,listclass.class"
/>
</target>
+
+ <target name="build-unittest" depends="compile">
+ <mkdir dir="${build.unittest}"/>
+ <javac srcdir="${unittest.dir}" destdir="${build.unittest}" debug="true">
+ <classpath path="${class.path}"/>
+ <classpath path="${build.dest}"/>
+ <classpath path="${junit.jar}"/>
+ </javac>
+ </target>
+
+ <target name="unittest" depends="build-unittest">
+ <mkdir dir="${build.unittest}"/>
+ <junit printsummary="no" fork="off" haltonfailure="yes">
+ <formatter type="plain" usefile="false"/>
+ <classpath path="${class.path}"/>
+ <classpath path="${build.dest}"/>
+ <classpath path="${junit.jar}"/>
+ <classpath path="${build.unittest}"/>
+ <batchtest>
+ <fileset dir="${build.unittest}">
+ <include name="**/*Test.class"/>
+ <include name="**/*Test_*.class"/>
+ <exclude name="**/*$*.class"/>
+ </fileset>
+ </batchtest>
+ </junit>
+ </target>
+
<!-- Compile the examples -->
<target name="examples" depends="compile">
--- /home/tackline/jakarta/jakarta-bcel/default.properties Fri Mar 28 14:55:42 2003
+++ default.properties Sat Apr 19 17:17:49 2003
@@ -13,3 +13,13 @@
docs.src = ./xdocs
docs.dest = ./docs
jdom.jar = jdom-b7.jar
+
+# ----- Default Base Path for Dependent Packages -----
+#base.path=/usr/share/java
+base.path=/usr/local
+
+# ----- JUnit Unit Test Suite, version 3.7 or later -----
+junit.home=${base.path}/junit3.7
+junit.lib=${junit.home}
+junit.jar=${junit.lib}/junit.jar
+#junit.loc=http://download.sourceforge.net/junit/junit3.7.zip