1# $FreeBSD$ 2 3failures=0 4 5check() { 6 testcase=$1 7 expect=$2 8 eval "set -- $testcase" 9 actual="$*" 10 if [ "$actual" != "$expect" ]; then 11 failures=$((failures+1)) 12 printf '%s\n' "For $testcase, expected $expect actual $actual" 13 fi 14} 15 16set -e 17T=$(mktemp -d ${TMPDIR:-/tmp}/sh-test.XXXXXX) 18trap 'rm -rf $T' 0 19cd -P $T 20 21mkdir !!a 22touch !!a/fff 23 24chmod u-r . 25check '!!a/ff*' '!!a/fff' 26chmod u+r . 27 28exit $((failures != 0)) 29