]>
Commit | Line | Data |
---|---|---|
deb63bfb | 1 | # $FreeBSD: head/bin/sh/tests/parser/heredoc1.0 204836 2010-03-07 15:08:42Z jilles $ |
71aad674 A |
2 | |
3 | failures=0 | |
4 | ||
5 | check() { | |
6 | if ! eval "[ $* ]"; then | |
7 | echo "Failed: $*" | |
8 | : $((failures += 1)) | |
9 | fi | |
10 | } | |
11 | ||
12 | check '"$(cat <<EOF | |
13 | hi | |
14 | EOF | |
15 | )" = hi' | |
16 | ||
17 | check '"$(cat <<EOF | |
18 | ${$+hi} | |
19 | EOF | |
20 | )" = hi' | |
21 | ||
22 | unset yy | |
23 | check '"$(cat <<EOF | |
24 | ${yy-hi} | |
25 | EOF | |
26 | )" = hi' | |
27 | ||
28 | check '"$(cat <<EOF | |
29 | ${$+hi | |
30 | there} | |
31 | EOF | |
32 | )" = "hi | |
33 | there"' | |
34 | ||
35 | check '"$(cat <<EOF | |
36 | $((1+1)) | |
37 | EOF | |
38 | )" = 2' | |
39 | ||
40 | check '"$(cat <<EOF | |
41 | $(echo hi) | |
42 | EOF | |
43 | )" = hi' | |
44 | ||
45 | check '"$(cat <<EOF | |
46 | `echo hi` | |
47 | EOF | |
48 | )" = hi' | |
49 | ||
50 | check '"$(cat <<\EOF | |
51 | ${$+hi} | |
52 | EOF | |
53 | )" = "\${\$+hi}"' | |
54 | ||
55 | check '"$(cat <<\EOF | |
56 | $( | |
57 | EOF | |
58 | )" = \$\(' | |
59 | ||
60 | check '"$(cat <<\EOF | |
61 | ` | |
62 | EOF | |
63 | )" = \`' | |
64 | ||
65 | check '"$(cat <<EOF | |
66 | " | |
67 | EOF | |
68 | )" = \"' | |
69 | ||
70 | check '"$(cat <<\EOF | |
71 | " | |
72 | EOF | |
73 | )" = \"' | |
74 | ||
75 | check '"$(cat <<esac | |
76 | '"'"' | |
77 | esac | |
78 | )" = "'"'"'"' | |
79 | ||
80 | check '"$(cat <<\) | |
81 | '"'"' | |
82 | ) | |
83 | )" = "'"'"'"' | |
84 | ||
85 | exit $((failures != 0)) |