Browse Source

additional tests for javah

this is really only a port of the junit test to antunit
master
Stefan Bodewig 9 years ago
parent
commit
1f9adc1d5b
1 changed files with 48 additions and 0 deletions
  1. +48
    -0
      src/tests/antunit/taskdefs/optional/javah-test.xml

+ 48
- 0
src/tests/antunit/taskdefs/optional/javah-test.xml View File

@@ -62,4 +62,52 @@ public class Adapter implements JavahAdapter {
</javah>
<au:assertLogContains text="adapter called" />
</target>

<target name="-setupForRealJavahTests">
<condition property="sunjavah.present">
<or>
<available classname="com.sun.tools.javah.oldjavah.Main"/>
<available classname="com.sun.tools.javah.Main"/>
</or>
</condition>
<mkdir dir="${input}/org/example"/>
<mkdir dir="${output}/org/example"/>
<echo file="${input}/org/example/Foo.java">
<![CDATA[
package org.example;
public class Foo {
public Foo() {}
public native String bar(Object baz);
}
]]></echo>
<javac srcdir="${input}" destdir="${output}"/>
<presetdef name="javah-single">
<javah destdir="${output}">
<class name="org.example.Foo"/>
<classpath>
<pathelement location="${output}"/>
</classpath>
</javah>
</presetdef>
<presetdef name="javah-fileset">
<javah destdir="${output}">
<fileset dir="${output}">
<include name="**/*.class"/>
</fileset>
<classpath>
<pathelement location="${output}"/>
</classpath>
</javah>
</presetdef>
</target>

<target name="testSimpleCompile" depends="-setupForRealJavahTests">
<javah-single/>
<au:assertFileExists file="${output}/org_example_Foo.h"/>
</target>

<target name="testCompileUsingFileset" depends="-setupForRealJavahTests">
<javah-fileset/>
<au:assertFileExists file="${output}/org_example_Foo.h"/>
</target>
</project>

Loading…
Cancel
Save