aboutsummaryrefslogtreecommitdiffstats
path: root/shell_cmds/sh/tests/parser/heredoc2.0
blob: f07f5d4b9ae95c531f8a6a7fede213c809327e3b (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
32
33
34
35
36
37
38
39
# $FreeBSD: head/bin/sh/tests/parser/heredoc2.0 211405 2010-08-16 21:14:49Z jilles $

failures=0

check() {
	if ! eval "[ $* ]"; then
		echo "Failed: $*"
		: $((failures += 1))
	fi
}

s='ast*que?non' sq=\' dq=\"

check '"$(cat <<EOF
${s}
EOF
)" = "ast*que?non"'

check '"$(cat <<EOF
${s+'$sq'x'$sq'}
EOF
)" = ${sq}x${sq}'

check '"$(cat <<EOF
${s#ast}
EOF
)" = "*que?non"'

check '"$(cat <<EOF
${s##"ast"}
EOF
)" = "*que?non"'

check '"$(cat <<EOF
${s##'$sq'ast'$sq'}
EOF
)" = "*que?non"'

exit $((failures != 0))