File: run-markup-tests.sh

package info (click to toggle)
glib2.0 2.24.2-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 46,108 kB
  • ctags: 31,166
  • sloc: ansic: 239,332; sh: 11,438; xml: 5,729; makefile: 2,551; perl: 1,259; python: 754; cpp: 9
file content (41 lines) | stat: -rwxr-xr-x 809 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

fail ()
{
  echo "Test failed: $*"
  exit 1
}

echo_v ()
{
  if [ "$verbose" = "1" ]; then
    echo "$*"
  fi
}

error_out=/dev/null
if [ "$1" = "-v" ]; then
  verbose=1
  error_out=/dev/stderr
fi
for I in ${srcdir:-.}/markups/fail-*.gmarkup; do
  echo_v "Parsing $I, should fail"
  ./markup-test $I > /dev/null 2> $error_out && fail "failed to generate error on $I"
  if test "$?" != "1"; then
    fail "unexpected error on $I"
  fi  
done

I=1
while test $I -lt 100 ; do
  F=${srcdir:-.}/markups/valid-$I.gmarkup
  if [ -f $F ] ; then
    echo_v "Parsing $F, should succeed"
    ./markup-test $F > actual 2> $error_out || fail "failed on $F"
    diff ${srcdir:-.}/markups/expected-$I actual || fail "unexpected output on $F"
    rm actual
  fi
  I=`expr $I + 1`
done

echo_v "All tests passed."