File indexing completed on 2024-05-12 11:33:01
0001 __tests=0 0002 __passed=0 0003 __failed=0 0004 __title= 0005 0006 title() { 0007 __title="$*" 0008 if [ "$VERBOSE" ]; then 0009 ./echo "$__title" 0010 else 0011 ./echo -n "$__title" \ 0012 '.................................................................' | ./cols 54 0013 fi 0014 } 0015 0016 0017 summary() { 0018 if [ -z "$VERBOSE" ]; then 0019 if [ $__failed -eq 0 ]; then 0020 ./echo " OK" 0021 else 0022 ./echo 0023 ./echo "$1: $__tests tests; $__failed failed/$__passed passed" 0024 ./echo 0025 fi 0026 fi 0027 } 0028 0029 0030 try_header() { 0031 testcase=`./echo -n " $1" '........................................................' | ./cols 50` 0032 __tests=`expr $__tests + 1` 0033 0034 test "$VERBOSE" && ./echo -n "$testcase" 0035 } 0036 0037 0038 0039 try() { 0040 unset FLAGS 0041 while [ "$1" ]; do 0042 case "$1" in 0043 -*) FLAGS="$FLAGS $1" 0044 shift ;; 0045 *) break ;; 0046 esac 0047 done 0048 0049 try_header $1 0050 0051 case "$2" in 0052 -t*) Q=`./markdown $FLAGS "$2"` ;; 0053 *) Q=`./echo "$2" | ./markdown $FLAGS` ;; 0054 esac 0055 0056 if [ "$3" = "$Q" ]; then 0057 __passed=`expr $__passed + 1` 0058 test $VERBOSE && ./echo " ok" 0059 else 0060 __failed=`expr $__failed + 1` 0061 if [ -z "$VERBOSE" ]; then 0062 ./echo 0063 ./echo "$1" 0064 fi 0065 ./echo "source:" 0066 ./echo "$2" | sed -e 's/^/ /' 0067 ./echo "diff:" 0068 (./echo "$3" >> $$.w 0069 ./echo "$Q" >> $$.g 0070 diff $$.w $$.g ) | sed -e 's/^/ /' 0071 rm -f $$.w $$.g 0072 rc=1 0073 fi 0074 } 0075 0076 match() { 0077 testcase=`./echo -n " $1" '........................................................' | ./cols 50` 0078 0079 test $VERBOSE && ./echo -n "$testcase" 0080 0081 if ./echo "$2" | ./markdown | grep "$3" >/dev/null; then 0082 test $VERBOSE && ./echo " ok" 0083 else 0084 if [ -z "$VERBOSE" ]; then 0085 ./echo 0086 ./echo "$testcase" 0087 fi 0088 rc=1 0089 fi 0090 }