diff options
| author | Eyal Posener <[email protected]> | 2019-10-23 22:46:40 +0300 |
|---|---|---|
| committer | Eyal Posener <[email protected]> | 2019-10-23 22:49:48 +0300 |
| commit | f7264fe38585e1c6efe68ea27bc27747fc21cf84 (patch) | |
| tree | f2a8af9bf26cb8fca022da1246268969adc2d7ef /args_test.go | |
| parent | e24ae2ec882eef4b8d9f42177fd026d3db4bdb73 (diff) | |
fix off-by-one error for sub command completion.
Fixes #97
Diffstat (limited to 'args_test.go')
| -rw-r--r-- | args_test.go | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/args_test.go b/args_test.go index e67125e..3b42db0 100644 --- a/args_test.go +++ b/args_test.go @@ -4,6 +4,8 @@ import ( "fmt" "strings" "testing" + + "github.com/stretchr/testify/assert" ) func TestArgs(t *testing.T) { @@ -131,15 +133,11 @@ func TestArgs_From(t *testing.T) { for _, tt := range tests { t.Run(fmt.Sprintf("%s/%d", tt.line, tt.from), func(t *testing.T) { - a := newArgs(tt.line) + a := newArgs("cmd " + tt.line) n := a.from(tt.from) - if got, want := strings.Join(n.All, " "), tt.newLine; got != want { - t.Errorf("%s failed: all = %q, want %q", t.Name(), got, want) - } - if got, want := strings.Join(n.Completed, " "), tt.newCompleted; got != want { - t.Errorf("%s failed: completed = %q, want %q", t.Name(), got, want) - } + assert.Equal(t, tt.newLine, strings.Join(n.All, " ")) + assert.Equal(t, tt.newCompleted, strings.Join(n.Completed, " ")) }) } } |
