0 | |
Variable substitution
|
1 | |
---------------------
|
|
0 |
Falderal Test: Variable substitution
|
|
1 |
------------------------------------
|
2 | 2 |
|
3 | 3 |
Tests for variable substitution, and quoting rules during such.
|
4 | 4 |
|
|
6 | 6 |
of all `%(...)` variables occurring in a shell command template;
|
7 | 7 |
it is not necessary to put any quotes around them in the template string.
|
8 | 8 |
|
9 | |
...
|
|
9 |
-> Functionality "Echo Body" is implemented by shell command
|
|
10 |
-> "python echo.py %(test-body-text)"
|
|
11 |
|
|
12 |
-> Tests for functionality "Echo Body"
|
|
13 |
|
|
14 |
| foo
|
|
15 |
+ bar
|
|
16 |
= foo
|
|
17 |
|
|
18 |
Single quotes in the test body text are single escaped.
|
|
19 |
|
|
20 |
| don't
|
|
21 |
+ can't
|
|
22 |
= don't
|
|
23 |
|
|
24 |
-> Functionality "Echo Input" is implemented by shell command
|
|
25 |
-> "python echo.py %(test-input-text)"
|
|
26 |
|
|
27 |
-> Tests for functionality "Echo Input"
|
|
28 |
|
|
29 |
| foo
|
|
30 |
+ bar
|
|
31 |
= bar
|
|
32 |
|
|
33 |
Single quotes in the test input text are single escaped.
|
|
34 |
|
|
35 |
| don't
|
|
36 |
+ can't
|
|
37 |
= can't
|
10 | 38 |
|
11 | 39 |
Note that when variables are expanded, backslash sequences in the
|
12 | 40 |
replacement string ("\n", etc) are not expanded.
|
13 | 41 |
|
14 | |
-> Functionality "Echo" is implemented by
|
15 | |
-> shell command "python echo.py %(test-body-text)"
|
16 | |
|
17 | |
-> Tests for functionality "Echo"
|
|
42 |
-> Tests for functionality "Echo Body"
|
18 | 43 |
|
19 | 44 |
| he\nl\tl\\o
|
20 | 45 |
= he\nl\tl\\o
|
21 | 46 |
|
22 | |
Note that single quotes needn't be supplied around `%(test-body-file)`
|
23 | |
or `%(output-file)`.
|
|
47 |
The rule that Falderal is responsible for quoting text substituted
|
|
48 |
into the command template extends to `%(test-body-file)` and
|
|
49 |
`%(test-input-file)` and `%(output-file)` as well.
|
24 | 50 |
|
25 | 51 |
-> Functionality "Cat, from file" is implemented by
|
26 | 52 |
-> shell command "python cat.py -f %(test-body-file)"
|
|
60 | 86 |
| hi
|
61 | 87 |
= hi
|
62 | 88 |
= hi
|
|
89 |
|
|
90 |
-> Functionality "Cat input, from file" is implemented by
|
|
91 |
-> shell command "python cat.py -f %(test-input-file)"
|
|
92 |
|
|
93 |
-> Tests for functionality "Cat input, from file"
|
|
94 |
|
|
95 |
| hekko
|
|
96 |
+ hello
|
|
97 |
= hello
|
|
98 |
|
|
99 |
| hj
|
|
100 |
| hj
|
|
101 |
+ hi
|
|
102 |
+ hi
|
|
103 |
= hi
|
|
104 |
= hi
|