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