positional8.0 revision 303975
1# $FreeBSD: releng/11.0/bin/sh/tests/parameters/positional8.0 291025 2015-11-18 21:09:03Z jilles $ 2 3failures='' 4ok='' 5 6testcase() { 7 code="$1" 8 expected="$2" 9 oIFS="$IFS" 10 eval "$code" 11 IFS='|' 12 result="$#|$*" 13 IFS="$oIFS" 14 if [ "x$result" = "x$expected" ]; then 15 ok=x$ok 16 else 17 failures=x$failures 18 echo "For $code, expected $expected actual $result" 19 fi 20} 21 22testcase 'shift $#; set -- ""$*' '1|' 23testcase 'shift $#; set -- $*""' '1|' 24testcase 'shift $#; set -- ""$@' '1|' 25testcase 'shift $#; set -- $@""' '1|' 26testcase 'shift $#; set -- """$*"' '1|' 27testcase 'shift $#; set -- "$*"""' '1|' 28testcase 'shift $#; set -- """$@"' '1|' 29testcase 'shift $#; set -- "$@"""' '1|' 30 31test "x$failures" = x 32