Home | History | Annotate | Download | only in tests
      1 #! /bin/sh
      2 
      3 fail ()
      4 {
      5   echo "Test failed: $*"
      6   exit 1
      7 }
      8 
      9 echo_v ()
     10 {
     11   if [ "$verbose" = "1" ]; then
     12     echo "$*"
     13   fi
     14 }
     15 
     16 error_out=/dev/null
     17 if [ "$1" = "-v" ]; then
     18   verbose=1
     19   error_out=/dev/stderr
     20 fi  
     21 for I in ${srcdir:-.}/bookmarks/fail-*.xbel; do
     22   echo_v "Parsing $I, should fail"
     23   ./bookmarkfile-test $I > /dev/null 2> $error_out && fail "failed to generate error on $I"
     24   if test "$?" != "1"; then
     25     fail "unexpected error on $I"
     26   fi  
     27 done
     28 
     29 for I in ${srcdir:-.}/bookmarks/valid-*.xbel; do
     30   echo_v "Parsing $I, should succeed"
     31   ./bookmarkfile-test $I > /dev/null 2> $error_out || fail "failed on $I"
     32 done
     33 
     34 echo_v "All tests passed."
     35