Initial import of binutils 2.22 on the new vendor branch
[dragonfly.git] / tools / regression / bin / sh / parser / heredoc4.0
1 # $FreeBSD: src/tools/regression/bin/sh/parser/heredoc4.0,v 1.1 2010/05/30 14:11:27 jilles Exp $
2
3 failures=0
4
5 check() {
6         if ! eval "[ $* ]"; then
7                 echo "Failed: $*"
8                 : $((failures += 1))
9         fi
10 }
11
12 f() {
13         cat <<EOF && echo `echo bar`
14 foo
15 EOF
16 }
17 check '"`f`" = "foo
18 bar"'
19
20 f() {
21         cat <<EOF && echo $(echo bar)
22 foo
23 EOF
24 }
25 check '"$(f)" = "foo
26 bar"'
27
28 f() {
29         echo `echo bar` && cat <<EOF
30 foo
31 EOF
32 }
33 check '"`f`" = "bar
34 foo"'
35
36 f() {
37         echo $(echo bar) && cat <<EOF
38 foo
39 EOF
40 }
41 check '"$(f)" = "bar
42 foo"'
43
44 exit $((failures != 0))