1#! /bin/sh 2 3fail () 4{ 5 echo "Test failed: $*" 6 exit 1 7} 8 9echo_v () 10{ 11 if [ "$verbose" = "1" ]; then 12 echo "$*" 13 fi 14} 15 16error_out=/dev/null 17if [ "$1" = "-v" ]; then 18 verbose=1 19 error_out=/dev/stderr 20fi 21for 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 27done 28 29for 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" 32done 33 34echo_v "All tests passed." 35