xref: /freebsd/bin/sh/tests/parser/heredoc5.0 (revision e6bfd18d21b225af6a0ed67ceeaf1293b7b9eba5)
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 `cat <<EOF
14bar
15EOF
16`
17foo
18EOF
19}
20check '"`f`" = "foo
21bar"'
22
23f() {
24	cat <<EOF && echo $(cat <<EOF
25bar
26EOF
27)
28foo
29EOF
30}
31check '"$(f)" = "foo
32bar"'
33
34f() {
35	echo `cat <<EOF
36bar
37EOF
38` && cat <<EOF
39foo
40EOF
41}
42check '"`f`" = "bar
43foo"'
44
45f() {
46	echo $(cat <<EOF
47bar
48EOF
49) && cat <<EOF
50foo
51EOF
52}
53check '"$(f)" = "bar
54foo"'
55
56exit $((failures != 0))
57