diff options
| author | Pablo Diaz <[email protected]> | 2022-05-21 17:44:32 +0200 |
|---|---|---|
| committer | Ilja Neumann <[email protected]> | 2023-06-03 02:39:56 +0200 |
| commit | 5f10667949b09f9a43c241d969eea8d3ba9456c0 (patch) | |
| tree | f699c397356663d51f6f923cc49d78b4b5c31592 /usage_test.go | |
| parent | c3cac76438ca36d9291d2a26f3ba558ef929d588 (diff) | |
fixed tests
Diffstat (limited to 'usage_test.go')
| -rw-r--r-- | usage_test.go | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/usage_test.go b/usage_test.go index d5e150f..5ac7757 100644 --- a/usage_test.go +++ b/usage_test.go @@ -544,14 +544,18 @@ Options: } func TestUsageWithEnvOptions(t *testing.T) { - expectedUsage := "Usage: example [-s SHORT]" + expectedUsage := "Usage: [CUSTOM=custom_value] [ENVONLY=envonly_value] example [-s SHORT]" expectedHelp := ` -Usage: example [-s SHORT] +Usage: [CUSTOM=custom_value] [ENVONLY=envonly_value] example [-s SHORT] Options: -s SHORT [env: SHORT] --help, -h display this help and exit + +Environment variables: + ENVONLY + CUSTOM ` var args struct { Short string `arg:"--,-s,env"` @@ -648,10 +652,10 @@ Options: } func TestFailEnvOnly(t *testing.T) { - expectedUsage := "Usage: AUTH_KEY=auth_key_value example [--arg ARG]" + expectedUsage := "Usage: [AUTH_KEY=auth_key_value] example [--arg ARG]" expectedHelp := ` -Usage: AUTH_KEY=auth_key_value example [--arg ARG] +Usage: [AUTH_KEY=auth_key_value] example [--arg ARG] Options: --arg ARG, -a ARG [env: MY_ARG] @@ -662,7 +666,7 @@ Environment variables: ` var args struct { ArgParam string `arg:"-a,--arg,env:MY_ARG"` - AuthKey string `arg:"-,--,env:AUTH_KEY"` + AuthKey string `arg:"--,env:AUTH_KEY"` } p, err := NewParser(Config{Program: "example"}, &args) assert.NoError(t, err) |
