File: runtests.sh

package info (click to toggle)
haskell-texmath 0.6.6.1-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 780 kB
  • ctags: 2
  • sloc: haskell: 1,726; sh: 32; makefile: 4
file content (41 lines) | stat: -rwxr-xr-x 1,233 bytes parent folder | download | duplicates (2)
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
#!/bin/sh
# Note: this should be run from within the tests directory
# Make sure you've set the 'test' flag using Cabal:
# cabal install -ftest
# Otherwise the test program 'texmath' won't be built.
# Exit status is number of failed tests.
TESTPROG=../dist/build/texmath/texmath
totalfailures=0

for format in xhtml omml; do
  failures=0
  passes=0
  if [ -f $TESTPROG ]; then
      for t in *.tex; do
          $TESTPROG --${format} <$t >tmp
          testname="Test ${t%.tex} ${format}"
          if [ "$?" -ne "0" ]; then
            echo "${testname} FAILED"
            failures=`expr $failures + 1`
          else
            diff -u ${t%.tex}.${format} tmp >tmpdiff
            if [ "$?" -ne "0" ]; then
                echo "${testname} (- expected, + actual):"
                cat tmpdiff
                failures=`expr $failures + 1`
            else
                echo "${testname} PASSED"
                passes=`expr $passes + 1`
            fi
          fi
      done
  else
      echo "Test executable not built. NOT running tests."
  fi
  echo "$format: $passes tests passed, $failures tests failed."
  totalfailures=`expr $totalfailures + $failures`
done
echo "$totalfailures tests failed total."
exit $failures