xref: /freebsd/bin/sh/tests/parser/heredoc2.0 (revision 2e3f49888ec8851bafb22011533217487764fdb0)
1
2failures=0
3
4check() {
5	if ! eval "[ $* ]"; then
6		echo "Failed: $*"
7		: $((failures += 1))
8	fi
9}
10
11s='ast*que?non' sq=\' dq=\"
12
13check '"$(cat <<EOF
14${s}
15EOF
16)" = "ast*que?non"'
17
18check '"$(cat <<EOF
19${s+'$sq'x'$sq'}
20EOF
21)" = ${sq}x${sq}'
22
23check '"$(cat <<EOF
24${s#ast}
25EOF
26)" = "*que?non"'
27
28check '"$(cat <<EOF
29${s##"ast"}
30EOF
31)" = "*que?non"'
32
33check '"$(cat <<EOF
34${s##'$sq'ast'$sq'}
35EOF
36)" = "*que?non"'
37
38exit $((failures != 0))
39