add test for case where environment var is not present
This commit is contained in:
parent
f2f7bdbbd7
commit
c8c61cf8bb
|
@ -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"`
|
||||
|
|
Loading…
Reference in New Issue