]>
Commit | Line | Data |
---|---|---|
deb63bfb | 1 | # $FreeBSD: head/bin/sh/tests/parser/heredoc2.0 211405 2010-08-16 21:14:49Z 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 | s='ast*que?non' sq=\' dq=\" | |
13 | ||
14 | check '"$(cat <<EOF | |
15 | ${s} | |
16 | EOF | |
17 | )" = "ast*que?non"' | |
18 | ||
19 | check '"$(cat <<EOF | |
20 | ${s+'$sq'x'$sq'} | |
21 | EOF | |
22 | )" = ${sq}x${sq}' | |
23 | ||
24 | check '"$(cat <<EOF | |
25 | ${s#ast} | |
26 | EOF | |
27 | )" = "*que?non"' | |
28 | ||
29 | check '"$(cat <<EOF | |
30 | ${s##"ast"} | |
31 | EOF | |
32 | )" = "*que?non"' | |
33 | ||
34 | check '"$(cat <<EOF | |
35 | ${s##'$sq'ast'$sq'} | |
36 | EOF | |
37 | )" = "*que?non"' | |
38 | ||
39 | exit $((failures != 0)) |