xref: /freebsd/bin/sh/tests/parser/heredoc4.0 (revision e8d8bef961a50d4dc22501cde4fb9fb0be1b2532)
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