summary refs log tree commit diff
path: root/bin/cash/tests/parameters/positional8.0
blob: e04ec7c928f30b8ef6fd15abe02851ec6c8d6ced (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# $FreeBSD: releng/12.0/bin/sh/tests/parameters/positional8.0 291025 2015-11-18 21:09:03Z jilles $

failures=''
ok=''

testcase() {
	code="$1"
	expected="$2"
	oIFS="$IFS"
	eval "$code"
	IFS='|'
	result="$#|$*"
	IFS="$oIFS"
	if [ "x$result" = "x$expected" ]; then
		ok=x$ok
	else
		failures=x$failures
		echo "For $code, expected $expected actual $result"
	fi
}

testcase 'shift $#; set -- ""$*'		'1|'
testcase 'shift $#; set -- $*""'		'1|'
testcase 'shift $#; set -- ""$@'		'1|'
testcase 'shift $#; set -- $@""'		'1|'
testcase 'shift $#; set -- """$*"'		'1|'
testcase 'shift $#; set -- "$*"""'		'1|'
testcase 'shift $#; set -- """$@"'		'1|'
testcase 'shift $#; set -- "$@"""'		'1|'

test "x$failures" = x