]> git.sesse.net Git - xml-template/blob - tests/test.sh
Add a simple test harness.
[xml-template] / tests / test.sh
1 #! /bin/sh
2
3 TESTS="simple clone include attribute attribute2"
4 LANGUAGES="perl php python"
5
6 for L in $LANGUAGES; do
7         for T in $TESTS; do
8                 echo -n "Testing $L/$T... "
9                 TEMPFILE=$( tempfile )
10
11                 if [ "$L" = "perl" ]; then
12                         perl -I../perl ../perl/$T.pl > $TEMPFILE
13                 fi
14                 if [ "$L" = "php" ]; then
15                         php4-cgi ../php/$T.php > $TEMPFILE
16                 fi
17                 if [ "$L" = "php" ]; then
18                         python ../python/$T.py > $TEMPFILE
19                 fi
20
21                 ./xml-diff.pl reference/$T.xml 2>/dev/null
22                 if [ $? = 0 ]; then     
23                         echo "passed."
24                 else 
25                         echo "FAILED."
26                 fi
27
28                 rm -f $TEMPFILE
29         done
30 done
31