Skip to content

Commit

Permalink
envsubst: Improve strict mode tests
Browse files Browse the repository at this point in the history
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
  • Loading branch information
stefanprodan committed Apr 8, 2024
1 parent b3eaa12 commit c061582
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions envsubst/eval_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -271,13 +271,27 @@ func TestExpandStrict(t *testing.T) {
output: "bar",
wantErr: nil,
},
// existing string empty
{
params: map[string]string{"foo": ""},
input: "${foo}",
output: "",
wantErr: nil,
},
// missing
{
params: map[string]string{},
input: "${missing}",
output: "",
wantErr: errVarNotSet,
},
// missing but has default
{
params: map[string]string{"foo": "bar"},
input: "${missing:=default}",
output: "default",
wantErr: nil,
},
}

for _, expr := range expressions {
Expand Down

0 comments on commit c061582

Please sign in to comment.