updated to clean up compiler issues with how functions were used from basis namespace;
[feisty_meow.git] / scripts / shunit / example_shunit_test.sh
1 #!/bin/bash
2
3 # An example of using shunit2.
4 #
5 # Author: Chris Koeritz
6 # license gnu gpl v3
7
8 export WORKDIR="$( \cd "$(\dirname "$0")" && \pwd )"  # obtain the script's working directory.
9 if [[ ! "$0" =~ ^/.* ]]; then
10   # re-run the script with an absolute path if it didn't start out that way; otherwise,
11   # shunit is not happy with finding the script.
12   exec "$WORKDIR/$(basename $0)" $*
13 fi
14 cd $WORKDIR
15
16 oneTimeSetUp()
17 {
18   echo "into oneTimeSetUp."
19 }
20
21 testOneThing()
22 {
23   echo "got to primary test case."
24   zero=0
25   assertEquals "zero should be equal to 0" 0 $zero
26   echo "passed tautological test."
27   sleep_time=83
28   echo "$(date): now sleeping for $sleep_time seconds."
29   sleep $sleep_time
30   echo "$(date): woke up."
31 }
32
33 oneTimeTearDown()
34 {
35   echo "into oneTimeTearDown."
36 }
37
38 # load and run shUnit2
39 source $SHUNIT_DIR/shunit2
40