2019-11-13 00:09:34 -07:00
|
|
|
#!/bin/sh
|
2019-11-12 22:38:16 -07:00
|
|
|
# do some unit testing
|
|
|
|
|
2019-11-13 00:09:34 -07:00
|
|
|
# print the error to stderr prefixed with caller info
|
2019-11-12 22:38:16 -07:00
|
|
|
terr () {
|
2019-11-13 00:09:34 -07:00
|
|
|
echo "$caller:" $@ >&2
|
2019-11-12 22:38:16 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
# get variable values and functions for testing
|
2019-11-13 00:09:34 -07:00
|
|
|
. ./msctl
|
2019-11-12 22:38:16 -07:00
|
|
|
|
|
|
|
# override some vars from msctl with values that allow testing
|
|
|
|
|
|
|
|
|
|
|
|
# funcs like getMSCSValue have local vars based on WORLDS_LOCATION.
|
|
|
|
WORLDS_LOCATION=/tmp
|
2019-11-13 01:16:19 -07:00
|
|
|
MSCS_DEFAULTS="/tmp/mscs.defaults"
|
2019-11-12 22:38:16 -07:00
|
|
|
testworld="mscs-testdata"
|
|
|
|
# tests will write to this propfile to verify parsing etc.
|
|
|
|
propfile="$WORLDS_LOCATION/$testworld/mscs.properties"
|
|
|
|
mkdir -p $(dirname $propfile) || exit 1
|
|
|
|
|
|
|
|
# run the tests; no news is good news!
|
|
|
|
for t in tests/*; do
|
2019-11-13 00:09:34 -07:00
|
|
|
caller=`basename "$t"`
|
|
|
|
. "$t"
|
2019-11-12 22:38:16 -07:00
|
|
|
done
|