added test that library does not directly access environment variables from OS
This commit is contained in:
parent
09d28e1195
commit
22f214d7ed
|
@ -792,19 +792,18 @@ func TestEnvironmentVariableEmptyMap(t *testing.T) {
|
||||||
assert.Len(t, args.Foo, 0)
|
assert.Len(t, args.Foo, 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
// func TestEnvironmentVariableIgnored(t *testing.T) {
|
func TestEnvironmentVariableIgnored(t *testing.T) {
|
||||||
// var args struct {
|
var args struct {
|
||||||
// Foo string `arg:"env"`
|
Foo string `arg:"env"`
|
||||||
// }
|
}
|
||||||
// setenv(t, "FOO", "abc")
|
|
||||||
|
|
||||||
// p, err := NewParser(Config{IgnoreEnv: true}, &args)
|
// the library should never read env vars direct from os
|
||||||
// require.NoError(t, err)
|
os.Setenv("FOO", "123")
|
||||||
|
|
||||||
// err = p.Parse(nil)
|
_, err := parseWithEnv(&args, "")
|
||||||
// assert.NoError(t, err)
|
require.NoError(t, err)
|
||||||
// assert.Equal(t, "", args.Foo)
|
assert.Equal(t, "", args.Foo)
|
||||||
// }
|
}
|
||||||
|
|
||||||
// func TestDefaultValuesIgnored(t *testing.T) {
|
// func TestDefaultValuesIgnored(t *testing.T) {
|
||||||
// var args struct {
|
// var args struct {
|
||||||
|
|
Loading…
Reference in New Issue