diff options
| author | Alex Flint <[email protected]> | 2019-05-02 09:44:48 -0700 |
|---|---|---|
| committer | Alex Flint <[email protected]> | 2019-05-02 09:44:48 -0700 |
| commit | c8c61cf8bbc4849c252c52b61381c072fcde66a6 (patch) | |
| tree | df0107632be930f0fc95019de3f591ff471f3c32 /parse_test.go | |
| parent | f2f7bdbbd7f2dba359ce7e8bd8cd60cd54ce20e6 (diff) | |
add test for case where environment var is not present
Diffstat (limited to 'parse_test.go')
| -rw-r--r-- | parse_test.go | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/parse_test.go b/parse_test.go index de36d67..c44fe00 100644 --- a/parse_test.go +++ b/parse_test.go @@ -557,6 +557,15 @@ func TestEnvironmentVariable(t *testing.T) { assert.Equal(t, "bar", args.Foo) } +func TestEnvironmentVariableNotPresent(t *testing.T) { + var args struct { + NotPresent string `arg:"env"` + } + os.Args = []string{"example"} + MustParse(&args) + assert.Equal(t, "", args.NotPresent) +} + func TestEnvironmentVariableOverrideName(t *testing.T) { var args struct { Foo string `arg:"env:BAZ"` |
