Merge pull request #347 from rasa/develop
This commit is contained in:
commit
0b75e71237
2 changed files with 22 additions and 0 deletions
|
@ -238,3 +238,22 @@ def test_include(runner, yadm, tmpdir):
|
||||||
assert run.err == ''
|
assert run.err == ''
|
||||||
assert output_file.read() == EXPECTED_INCLUDE
|
assert output_file.read() == EXPECTED_INCLUDE
|
||||||
assert os.stat(output_file).st_mode == os.stat(input_file).st_mode
|
assert os.stat(output_file).st_mode == os.stat(input_file).st_mode
|
||||||
|
|
||||||
|
|
||||||
|
def test_env(runner, yadm, tmpdir):
|
||||||
|
"""Test env"""
|
||||||
|
|
||||||
|
input_file = tmpdir.join('input')
|
||||||
|
input_file.write('{{env.PWD}}', ensure=True)
|
||||||
|
input_file.chmod(FILE_MODE)
|
||||||
|
output_file = tmpdir.join('output')
|
||||||
|
|
||||||
|
script = f"""
|
||||||
|
YADM_TEST=1 source {yadm}
|
||||||
|
set_awk
|
||||||
|
template_default "{input_file}" "{output_file}"
|
||||||
|
"""
|
||||||
|
run = runner(command=['bash'], inp=script)
|
||||||
|
assert run.success
|
||||||
|
assert run.err == ''
|
||||||
|
assert output_file.read().strip() == os.environ['PWD']
|
||||||
|
|
3
yadm
3
yadm
|
@ -425,6 +425,9 @@ function replace_vars() {
|
||||||
for (label in c) {
|
for (label in c) {
|
||||||
gsub(("{{" blank "*yadm\\." label blank "*}}"), c[label])
|
gsub(("{{" blank "*yadm\\." label blank "*}}"), c[label])
|
||||||
}
|
}
|
||||||
|
for (label in ENVIRON) {
|
||||||
|
gsub(("{{" blank "*env\\." label blank "*}}"), ENVIRON[label])
|
||||||
|
}
|
||||||
}
|
}
|
||||||
function condition_helper(label, value) {
|
function condition_helper(label, value) {
|
||||||
gsub(/[\\.^$(){}\[\]|*+?]/, "\\\\&", value)
|
gsub(/[\\.^$(){}\[\]|*+?]/, "\\\\&", value)
|
||||||
|
|
Loading…
Reference in a new issue