Skip to content

Commit

Permalink
WIP update test-cases for processing "--"
Browse files Browse the repository at this point in the history
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
  • Loading branch information
thaJeztah committed May 14, 2020
1 parent 2add9e1 commit ab8752d
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions command_test.go
Expand Up @@ -140,12 +140,13 @@ func TestParseAndRunHyphenValues(t *testing.T) {
{[]string{"foo", "test", "--opt", "--opt-value", "arg1", "arg2"}, []string{"arg1", "arg2"}, "--opt-value"},
{[]string{"foo", "test", "arg1", "--opt", "--opt-value"}, []string{"arg1"}, "--opt-value"},
{[]string{"foo", "test", "arg1", "--opt", "--opt-value", "arg2"}, []string{"arg1", "arg2"}, "--opt-value"},

{[]string{"foo", "test", "--", "arg1", "--opt", "--opt-value", "arg2"}, []string{""}, ""},
{[]string{"foo", "test", "arg1", "--", "--opt", "--opt-value", "arg2"}, []string{"arg1"}, ""},
{[]string{"foo", "test", "arg1", "--opt", "--", "--opt-value", "arg2"}, []string{"arg1"}, ""},
{[]string{"foo", "test", "arg1", "--opt", "--opt-value", "--", "arg2"}, []string{"arg1"}, "--opt-value"},
{[]string{"foo", "test", "arg1", "--opt", "--opt-value", "arg2", "--"}, []string{"arg1", "arg2"}, "--opt-value"},

{[]string{"foo", "test", "--", "--opt", "--opt-value", "arg1"}, []string{"--", "--opt", "--opt-value", "arg1"}, ""},
{[]string{"foo", "test", "--", "arg1", "--opt", "--opt-value", "arg2"}, []string{"--", "arg1", "--opt", "--opt-value", "arg2"}, ""},
{[]string{"foo", "test", "arg1", "--", "--opt", "--opt-value", "arg2"}, []string{"arg1", "--", "--opt", "--opt-value", "arg2"}, ""},
{[]string{"foo", "test", "arg1", "--opt", "--", "--opt-value", "arg2"}, []string{"arg1", "--", "--opt-value", "arg2"}, ""},
{[]string{"foo", "test", "arg1", "--opt", "--opt-value", "--", "arg2"}, []string{"arg1", "--", "arg2"}, "--opt-value"},
{[]string{"foo", "test", "arg1", "--opt", "--opt-value", "arg2", "--"}, []string{"arg1", "arg2", "--"}, "--opt-value"},
}

for _, tc := range cases {
Expand Down

0 comments on commit ab8752d

Please sign in to comment.