summaryrefslogtreecommitdiffstats
path: root/shell_cmds/sh/tests/expansion/trim5.0
blob: 8045eb6adae0cdfbadb8a4c3a582f65a43bee58a (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
# $FreeBSD: head/bin/sh/tests/expansion/trim5.0 214490 2010-10-28 21:51:14Z jilles $

e= q='?' a='*' t=texttext s='ast*que?non' p='/et[c]/' w='a b c' b='{{(#)}}'
h='##'
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 'set -- "${b%'\'}\''}"'		'1|{{(#)}'
testcase 'set -- ${b%"}"}'			'1|{{(#)}'
testcase 'set -- "${b%"}"}"'			'1|{{(#)}'

test "x$failures" = x