File indexing completed on 2024-04-28 15:28:38

0001 #! /bin/bash
0002 
0003 TOOL=~/obj/kdelibs/kjs/testkjs
0004 DIR=.
0005 
0006 if [ $# == 1 ]; then
0007     TOOL=$1
0008 fi
0009 
0010 echo "Starting to run tests"
0011 
0012 # test tool available ?
0013 if [ ! -x $TOOL ]; then
0014     echo "Can't execute test tool $TOOL"
0015     exit 1
0016 fi
0017 
0018 # can the shell test functions be parsed ?
0019 $TOOL $DIR/shell.js >/dev/null 2>&1
0020 if [ $? != 0 ]; then
0021     echo "Can't evaluate shell test functions in $DIR/shell.js"
0022     exit 2
0023 fi
0024 
0025 tests=`ls $DIR/*.js`
0026 for t in $tests; do
0027     if [ `echo $t | grep -- '-n.js$'` ]; then
0028         $TOOL $t >/dev/null 2>&1
0029         if [ $? != 0 ]; then
0030             echo "PASS Expected failure in $t"
0031         else
0032             echo "FAIL Unexpected pass in $t"
0033         fi
0034     else
0035         echo "Executing $t"
0036         $TOOL $DIR/shell.js $t
0037     fi
0038 done
0039 echo "Done"