Initial import of binutils 2.22 on the new vendor branch
[dragonfly.git] / tools / regression / bin / sh / parser / heredoc5.0
1 # $FreeBSD: src/tools/regression/bin/sh/parser/heredoc5.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 `cat <<EOF
14 bar
15 EOF
16 `
17 foo
18 EOF
19 }
20 check '"`f`" = "foo
21 bar"'
22
23 f() {
24         cat <<EOF && echo $(cat <<EOF
25 bar
26 EOF
27 )
28 foo
29 EOF
30 }
31 check '"$(f)" = "foo
32 bar"'
33
34 f() {
35         echo `cat <<EOF
36 bar
37 EOF
38 ` && cat <<EOF
39 foo
40 EOF
41 }
42 check '"`f`" = "bar
43 foo"'
44
45 f() {
46         echo $(cat <<EOF
47 bar
48 EOF
49 ) && cat <<EOF
50 foo
51 EOF
52 }
53 check '"$(f)" = "bar
54 foo"'
55
56 exit $((failures != 0))