forked from netresearch/rst2confluence
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run-tests.sh
executable file
·39 lines (35 loc) · 888 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
#!/bin/sh
# Runs rst2confluence.py on all .rst files in test/ and compares them
# to the expected output (.exp)
if [ $# -eq 0 ]; then
files=tests/rst/*.rst
else
files="$*"
fi
mkdir -p tests/tmp
for i in $files; do
echo -n Testing $i
i=`basename $i`
expFile="tests/exp/$i.exp"
outFile="tests/tmp/$i.out"
diffFile="tests/tmp/$i.diff"
rst2confluence "tests/rst/$i" "$outFile"
if [ $? -ne 0 ]; then
echo -e "\033[00;31merror running rst2confluence\033[00m"
break;
fi
if [ ! -f "$expFile" ]; then
expFile=/dev/null
fi
diff -u "$expFile" "$outFile" > "$diffFile"
if [ "$?" -ne "0" ]; then
echo -e " \033[00;31merror\033[00m"
cat "$diffFile" | colordiff
break;
else
#all fine
echo -e " \033[00;32mok\033[00m"
rm "$outFile"
rm "$diffFile"
fi
done