Tree @master (Download .tar.gz)
- ..
- cat.py
- crlf.py
- echo.py
- eg.silly-interpreter
- fail.py
- silly-interpreter.py
- test-appliances-a.markdown
- test-appliances-b.markdown
- test-appliances.expected
- test-bad-indentation.expected
- test-bad-indentation.markdown
- test-crlf.expected
- test-crlf.markdown
- test-err-no-stderr.expected
- test-err-no-stderr.markdown
- test-freestyle-format.expected
- test-freestyle-format.markdown
- test-ill-formed.expected
- test-ill-formed.markdown
- test-implementations-global-a.markdown
- test-implementations-global-b.markdown
- test-implementations-global.expected
- test-input-sections.expected
- test-input-sections.markdown
- test-no-eol.expected
- test-no-eol.markdown
- test-no-functionality-leak-a.markdown
- test-no-functionality-leak-b.markdown
- test-no-functionality-leak.expected
- test-no-functionality.expected
- test-no-functionality.markdown
- test-no-test-body.expected
- test-no-test-body.markdown
- test-no-tests.expected
- test-no-tests.markdown
- test-pass-fail.expected
- test-pass-fail.markdown
- test-shared-body.expected
- test-shared-body.markdown
- test-stdout-stderr.expected
- test-stdout-stderr.markdown
- test-substring-error.expected
- test-substring-error.markdown
- test-utf8.expected
- test-utf8.markdown
- test-var-subst.expected
- test-var-subst.markdown
test-var-subst.markdown @master — view markup · raw · history · blame
Falderal Test: Variable substitution
Tests for variable substitution, and quoting rules during such.
Note that Falderal is responsible for quoting the substitution text
of all %(...)
variables occurring in a shell command template;
it is not necessary to put any quotes around them in the template string.
-> Functionality "Echo Body" is implemented by shell command
-> "python3 echo.py %(test-body-text)"
-> Tests for functionality "Echo Body"
| foo
+ bar
= foo
Single quotes in the test body text are single escaped.
| don't
+ can't
= don't
-> Functionality "Echo Input" is implemented by shell command
-> "python3 echo.py %(test-input-text)"
-> Tests for functionality "Echo Input"
| foo
+ bar
= bar
Single quotes in the test input text are single escaped.
| don't
+ can't
= can't
Note that when variables are expanded, backslash sequences in the replacement string ("\n", etc) are not expanded.
-> Tests for functionality "Echo Body"
| he\nl\tl\\o
= he\nl\tl\\o
The rule that Falderal is responsible for quoting text substituted
into the command template extends to %(test-body-file)
and
%(test-input-file)
and %(output-file)
as well.
-> Functionality "Cat, from file" is implemented by
-> shell command "python3 cat.py -f %(test-body-file)"
-> Tests for functionality "Cat, from file"
| hello
= hello
| hi
| hi
= hi
= hi
-> Functionality "Cat, to file" is implemented by
-> shell command "python3 cat.py -o %(output-file)"
-> Tests for functionality "Cat, to file"
| hello
= hello
| hi
| hi
= hi
= hi
-> Functionality "Cat, to and from file" is implemented by
-> shell command "python3 cat.py -f %(test-body-file) -o %(output-file)"
-> Tests for functionality "Cat, to and from file"
| hello
= hello
| hi
| hi
= hi
= hi
-> Functionality "Cat input, from file" is implemented by
-> shell command "python3 cat.py -f %(test-input-file)"
-> Tests for functionality "Cat input, from file"
| hekko
+ hello
= hello
| hj
| hj
+ hi
+ hi
= hi
= hi