Skip to content

Commit

Permalink
Ok I'll stop now
Browse files Browse the repository at this point in the history
  • Loading branch information
jawher committed Nov 11, 2017
1 parent 9585ec9 commit 8bd9b13
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions internal/matcher/option_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (

func TestBoolOptMatcher(t *testing.T) {
forceOpt := &container.Container{Names: []string{"-f", "--force"}, Value: values.NewBool(new(bool), false)}

optMatcher := opt{
theOne: forceOpt,
index: map[string]*container.Container{
Expand All @@ -20,6 +21,9 @@ func TestBoolOptMatcher(t *testing.T) {
"-y": {Names: []string{"-y"}, Value: values.NewBool(new(bool), false)},
},
}

require.Equal(t, "-f", optMatcher.String())

cases := []struct {
args []string
nargs []string
Expand Down Expand Up @@ -86,6 +90,8 @@ func TestOptMatcher(t *testing.T) {
},
}

require.Equal(t, "-f", optMatcher.String())

pc := New()
ok, nargs := optMatcher.Match(cas.args, &pc)
require.True(t, ok, "opt %#v should match args %v, %v", forceOpt, cas.args, values.IsBool(forceOpt.Value))
Expand All @@ -112,6 +118,7 @@ func TestOptNegatives(t *testing.T) {
cases := []struct {
args []string
}{
{[]string{"-"}},
{[]string{"-", "x"}},
{[]string{"--", "y"}},
{[]string{"-c"}},
Expand Down

0 comments on commit 8bd9b13

Please sign in to comment.