-
Notifications
You must be signed in to change notification settings - Fork 54
/
run-tests.sh
executable file
·53 lines (43 loc) · 973 Bytes
/
run-tests.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/bash
# This script runs an absolutely trivial smoke test; we'll replace it
# with something better in due course
set -eu
cd $(dirname $0)/..
cleanup () {
local exit_val=$?
rm -f WORD.MDV
exit $exit_val
}
if [ ! -f WORD.MDV ]; then
cp test/WORD.MDV_template WORD.MDV
trap cleanup EXIT
fi
bin/words 'rem acu tetigisti' | diff -q -- - test/expected.txt
TEMP=$(tempfile)
run-tests () {
set +u
if [ "$TRAVIS" = "true" ]; then
set -u
TEMP2=$(tempfile)
bin/words < test/aeneid_bk4.txt | tee $TEMP2
diff -u -- - test/aeneid_bk4.txt.expected < $TEMP2 > $TEMP
rv=$?
rm -f -- $TEMP2 || true
return $rv
else
set -u
bin/words < test/aeneid_bk4.txt | \
diff -u -- - test/aeneid_bk4.expected > $TEMP
fi
}
if ! ( run-tests ); then
rv=$?
if [ -s "$TEMP" ]; then
cat $TEMP
fi
rm -f -- $TEMP
echo FAIL
exit $rv
fi
rm -f -- $TEMP
echo PASS