X-Git-Url: https://feistymeow.org/gitweb/?a=blobdiff_plain;f=testkit%2Fshunit%2Fexample_shunit_test.sh;fp=testkit%2Fshunit%2Fexample_shunit_test.sh;h=8931aef130e2e904ef09bc3cf977ca511f849ac6;hb=d46483c93ecc9a4ef7d80656d23bd0891ddf5ac6;hp=0000000000000000000000000000000000000000;hpb=4e15bc3b03c452086296b0b2e8dab709f34b5957;p=feisty_meow.git diff --git a/testkit/shunit/example_shunit_test.sh b/testkit/shunit/example_shunit_test.sh new file mode 100644 index 00000000..8931aef1 --- /dev/null +++ b/testkit/shunit/example_shunit_test.sh @@ -0,0 +1,40 @@ +#!/bin/bash + +# An example of using shunit2. +# +# Author: Chris Koeritz +# license gnu gpl v3 + +export THISDIR="$( \cd "$(\dirname "$0")" && /bin/pwd )" # obtain the script's working directory. +if [[ ! "$0" =~ ^/.* ]]; then + # re-run the script with an absolute path if it didn't start out that way; otherwise, + # shunit is not happy with finding the script. + exec "$THISDIR/$(basename $0)" $* +fi +cd $THISDIR + +oneTimeSetUp() +{ + echo "into oneTimeSetUp." +} + +testOneThing() +{ + echo "got to primary test case." + zero=0 + assertEquals "zero should be equal to 0" 0 $zero + echo "passed tautological test." + sleep_time=83 + echo "$(date): now sleeping for $sleep_time seconds." + sleep $sleep_time + echo "$(date): woke up." +} + +oneTimeTearDown() +{ + echo "into oneTimeTearDown." +} + +# load and run shUnit2 +source $SHUNIT_PATH/shunit2 +