From: Chris Koeritz Date: Thu, 10 May 2012 22:43:02 +0000 (-0400) Subject: nice changes to enable an shunit test to be called without requiring an X-Git-Tag: 2.140.90~1351 X-Git-Url: https://feistymeow.org/gitweb/?a=commitdiff_plain;h=af5f3c3dd22ed040f42a38265b6b5c8cba094b96;p=feisty_meow.git nice changes to enable an shunit test to be called without requiring an absolute path on the script name. --- diff --git a/scripts/shunit/example_shunit_test.sh b/scripts/shunit/example_shunit_test.sh index f499bf95..c3dc8de5 100755 --- a/scripts/shunit/example_shunit_test.sh +++ b/scripts/shunit/example_shunit_test.sh @@ -5,27 +5,30 @@ # Author: Chris Koeritz export WORKDIR="$( \cd "$(\dirname "$0")" && \pwd )" # obtain the script's working directory. -cd $WORKDIR - -# this variable needs to be set somewhere. feisty meow scripts will set it. -#SHUNIT_DIR=/home/fred/shunit +#cd $WORKDIR +if [[ ! "$0" =~ ^/.* ]]; then + # re-run the script with the absolute path if it didn't start that way; otherwise + # shunit is not happy with finding the script. + exec "$WORKDIR/$(basename $0)" $* +fi oneTimeSetUp() { - echo into set up. + echo "into oneTimeSetUp." } testOneThing() { - echo got to test case. + echo "got to test case. sleeping for a bit..." zero=0 assertEquals "zero should be equal to 0" 0 $zero sleep 23 + echo "woke up. passed tautological test." } oneTimeTearDown() { - echo into tear down. + echo "into oneTimeTearDown." } # load and run shUnit2