summary refs log tree commit diff
path: root/bin/cash/tests/parser/heredoc2.0
blob: e910ba27cb7fbf7ec294d10d4f29d9ce9cf54e69 (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: releng/12.0/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))