-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathrunAppTests.sh
36 lines (36 loc) · 888 Bytes
/
runAppTests.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
# version 1.42
runTest() {
local test=$1
local command=`head -1 $test | tr -d '\r'`
#echo $command
sed "1d" $test > expected.txt
#cat expected_output.txt
eval $command &> output.txt
diff -b output.txt expected.txt > /dev/null
if [ $? -eq 0 ]
then
result="✅"
else
result="❌"
echo "---------$test----------" >> failures.txt
echo "\t\t\t<= command =>\n$command" >> failures.txt
echo "\n\t\t\t<= actual output =>" >> failures.txt
cat output.txt >> failures.txt
echo "\n\t\t\t<= expected output =>" >> failures.txt
cat expected.txt >> failures.txt
fi
rm -f output.txt expected.txt
echo "$result $test"
}
echo "running $# tests"
echo "----- starting ---------"
rm -f failures.txt
for test in $*
do
runTest $test
done
echo "----- ending ---------"
if test -f failures.txt
then
echo "please look at failures.txt for details"
fi