mirror of
https://github.com/zaphar/test-tap.git
synced 2025-07-21 20:19:49 -04:00
helper script to make a javascript test
git-svn-id: https://test-tap.googlecode.com/svn/trunk@7 62346678-a08d-11dd-9c66-c9f8973bfffa
This commit is contained in:
parent
a819d9e3f2
commit
9337bc047e
66
scripts/mkjstest.sh
Normal file
66
scripts/mkjstest.sh
Normal file
@ -0,0 +1,66 @@
|
||||
#! /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
|
Loading…
x
Reference in New Issue
Block a user