summaryrefslogtreecommitdiff
path: root/args_test.go
diff options
context:
space:
mode:
authorEyal Posener <[email protected]>2019-10-23 23:03:05 +0300
committerGitHub <[email protected]>2019-10-23 23:03:05 +0300
commit98a0c28ec7908620d626d072df3a49c34eadc2b6 (patch)
treef2a8af9bf26cb8fca022da1246268969adc2d7ef /args_test.go
parent2f2ff270a9f6adcef8351b1bdf5319b5d612b53f (diff)
parentf7264fe38585e1c6efe68ea27bc27747fc21cf84 (diff)
Merge pull request #102 from posener/sub-cmd-bug
Fix off-by-one error for argument from method
Diffstat (limited to 'args_test.go')
-rw-r--r--args_test.go12
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, " "))
})
}
}