test-tap/scripts/mkjstest.sh
Jeremy@marzhillstudios.com 9337bc047e helper script to make a javascript test
git-svn-id: https://test-tap.googlecode.com/svn/trunk@7 62346678-a08d-11dd-9c66-c9f8973bfffa
2008-11-28 04:12:27 +00:00

67 lines
932 B
Bash

#! /bin/bash
usage()
{
cat << HELPMSG
Usage:
create a javascript test in the specified location
$0 -d <test directory> <test_name>
print this help
$0 -h
HELPMSG
}
while getopts ":d:h" OPTION
do
case $OPTION in
d)
DIRNAME=$OPTARG
;;
h)
usage
exit 1
;;
?)
usage
exit 1
;;
esac
done
shift $(($OPTIND - 1))
if [[ -z $DIRNAME ]]
then
echo 'Must provide a test directory'
usage
exit 1
fi
if [[ -z $1 ]]
then
echo 'Must provide a test name'
usage
exit 1
fi
TESTNAME=`echo $1 | tr '[:upper:]' '[:lower:]'`.t.js
cat > $DIRNAME/$TESTNAME << TEST
(function() {
var t = new Test.TAP.Class();
t.plan('no_plan');
t.setUp = function() {
};
t.testSomething = function() {
};
t.tearDown = function() {
};
return t;
})();
TEST