xref: /freebsd/bin/sh/tests/parser/heredoc5.0 (revision 22cf89c938886d14f5796fc49f9f020c23ea8eaf)
1
2failures=0
3
4check() {
5	if ! eval "[ $* ]"; then
6		echo "Failed: $*"
7		: $((failures += 1))
8	fi
9}
10
11f() {
12	cat <<EOF && echo `cat <<EOF
13bar
14EOF
15`
16foo
17EOF
18}
19check '"`f`" = "foo
20bar"'
21
22f() {
23	cat <<EOF && echo $(cat <<EOF
24bar
25EOF
26)
27foo
28EOF
29}
30check '"$(f)" = "foo
31bar"'
32
33f() {
34	echo `cat <<EOF
35bar
36EOF
37` && cat <<EOF
38foo
39EOF
40}
41check '"`f`" = "bar
42foo"'
43
44f() {
45	echo $(cat <<EOF
46bar
47EOF
48) && cat <<EOF
49foo
50EOF
51}
52check '"$(f)" = "bar
53foo"'
54
55exit $((failures != 0))
56