mirror of
https://github.com/zaphar/test-tap.git
synced 2025-07-21 20:19:49 -04:00

git-svn-id: https://test-tap.googlecode.com/svn/trunk@7 62346678-a08d-11dd-9c66-c9f8973bfffa
67 lines
932 B
Bash
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
|