diff options
| author | Dave Henderson <dhenderson@gmail.com> | 2017-04-30 23:54:47 -0400 |
|---|---|---|
| committer | Dave Henderson <dhenderson@gmail.com> | 2017-04-30 23:54:47 -0400 |
| commit | 9c9d1057ef134997bf017ea73bed6e89381b231e (patch) | |
| tree | 6eba1571b4f8691abb5b834ec456487f37f522d6 /test | |
| parent | 464584344f08329e0ac0877f735fb4c52c8a9425 (diff) | |
Reverting 9c4dfae and adding test to cover reason
The refactoring in 9c4dfae was a bit too clever - I changed behaviour
and started considering _empty_ envvars as valid. This _may_ be expected
in some use-cases, but `getenv` didn't work that way before, and it's
probably a surprising behaviour anyway.
Signed-off-by: Dave Henderson <dhenderson@gmail.com>
Diffstat (limited to 'test')
| -rw-r--r-- | test/integration/envvars.bats | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/test/integration/envvars.bats b/test/integration/envvars.bats index 6bec5695..c8a69ddd 100644 --- a/test/integration/envvars.bats +++ b/test/integration/envvars.bats @@ -27,6 +27,12 @@ load helper [[ "${output}" == "foo" ]] } +@test "default string with empty env var using getenv" { + FOO="" gomplate -i '{{getenv "FOO" "foo"}}' + [ "$status" -eq 0 ] + [[ "${output}" == "foo" ]] +} + @test "existant env var using .Env" { gomplate -i '{{.Env.HOME}}' [ "$status" -eq 0 ] |
