Created
May 23, 2014 02:02
-
-
Save rendon/e6df39b42e664c4904f4 to your computer and use it in GitHub Desktop.
Single Test Runner
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ -z $1 ] | |
then | |
echo "USAGE: $0 <test file without extension>"; | |
echo "EXAMPLE: $0 TestQuickSort"; | |
exit 1; | |
fi | |
cat > .build <<EOF | |
<?xml version="1.0" ?> | |
<project name="Test" default="compile"> | |
<target name="compileTest" description="Compile tests"> | |
<javac srcdir="." destdir="." includeantruntime="true"> | |
<include name="$1.java" /> | |
</javac> | |
</target> | |
<target name="test" depends="compileTest" description="Run tests"> | |
<junit> | |
<batchtest> | |
<fileset dir="."> | |
<include name="$1.class" /> | |
</fileset> | |
</batchtest> | |
<formatter type="plain" usefile="false" /> | |
</junit> | |
</target> | |
</project> | |
EOF | |
ant -buildfile .build test | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment