Root/b2/test/sublast

1#!/bin/bash
2. ./Common
3
4###############################################################################
5
6tst "substitutions: expand \$ from regular var" -q X=foo <<EOF
7!-s
8X=?*? { Y=\$\$ }
9EOF
10
11expect <<EOF
12Y=foo
13EOF
14
15#------------------------------------------------------------------------------
16
17tst "substitutions: expand \$ from FN" -q F1=bar <<EOF
18!-s
19FN=?*? { Y=\$\$ }
20EOF
21
22expect <<EOF
23Y=bar
24EOF
25
26#------------------------------------------------------------------------------
27
28tst_fail "substitutions: expand \$ without match" <<EOF
29!-s
30X=\$\$
31EOF
32
33expect <<EOF
34s:2: \$\$ without match
35EOF
36
37#------------------------------------------------------------------------------
38
39tst "substitutions: assign to \$ from regular var" -q X=bar <<EOF
40!-s
41X=?*? { \$=foo }
42EOF
43
44expect <<EOF
45X=foo
46EOF
47
48#------------------------------------------------------------------------------
49
50tst "substitutions: assign to \$ from FN" -q F1=foo <<EOF
51!-s
52FN=?*? { \$=bar }
53EOF
54
55expect <<EOF
56F1=bar
57EOF
58
59#------------------------------------------------------------------------------
60
61tst_fail "substitutions: assign to \$ without match" <<EOF
62!-s
63\$=bar
64EOF
65
66expect <<EOF
67s:2: \$ without match
68EOF
69
70#------------------------------------------------------------------------------
71
72tst "substitutions: match \$ from regular var" -q X=bar <<EOF
73!-s
74X=?*? { \$=b(*) { Y=\$1 } }
75EOF
76
77expect <<EOF
78Y=ar
79EOF
80
81#------------------------------------------------------------------------------
82
83tst "substitutions: match \$ from FN" -q F1=foo <<EOF
84!-s
85FN=?*? { \$=(*)o { Y=\$1 } }
86EOF
87
88expect <<EOF
89Y=fo
90EOF
91
92#------------------------------------------------------------------------------
93
94tst_fail "substitutions: match \$ without match" <<EOF
95!-s
96\$=* { X=X }
97EOF
98
99expect <<EOF
100s:2: \$ without match
101EOF
102
103###############################################################################
104

Archive Download this file

Branches:
master



interactive