forked from KarolS/fimpp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_tests.sh
executable file
·80 lines (58 loc) · 1.1 KB
/
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#!/bin/bash
set -ue
compare() {
out=$1
ok=${out%.out}.ok
local rv
if [ -e "$ok" ]; then
if ! diff -u "$ok" "$out"; then
rv=1
echo "failed"
else
rv=0
echo "ok"
rm "$out"
fi
else
rv=1
echo "first run"
cp "$out" "$ok"
fi
return $rv
}
rv=0
if [ "$#" -eq 1 ]; then
cmd=$1
else
cmd=""
fi
if [ -z "$cmd" -o "$cmd" = "examples" ]; then
echo "Testing examples"
for src in examples/*.fimpp; do
echo -n " `basename $src`... "
if grep -q swing "$src"; then
echo "skipped"
continue
fi
name=`basename "$src" .fimpp`
out="test/examples/${name}.out"
bin/fimpp "$src" > "$out" 2>&1
compare "$out" || rv=1
done
fi
if [ -z "$cmd" -o "$cmd" = "errors" ]; then
echo "Testing error messages"
for src in test/errors/*.fimpp; do
echo -n " `basename $src`... "
out=${src%.fimpp}.out
bin/fimpp "$src" > "$out" 2>&1 || true
compare "$out" || rv=1
done
fi
if [ -z "$cmd" -o "$cmd" = "unit" ]; then
out="test/UnitTests.out"
echo -n "Running unit tests... "
scala -classpath bin/fimpp.jar test/UnitTests.scala > "$out"
compare "$out" || rv=1
fi
exit "$rv"