Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
umarcor committed Aug 30, 2022
1 parent 828d70c commit 776257e
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions args_test.go
Expand Up @@ -38,12 +38,12 @@ func validOnlyWithInvalidArgs(err error, t *testing.T) {
}
}

func noArgsWithArgs(err error, t *testing.T) {
func noArgsWithArgs(err error, t *testing.T, arg string) {
if err == nil {
t.Fatal("Expected an error")
}
got := err.Error()
expected := `unknown command "one" for "c"`
expected := `unknown command "` + arg + `" for "c"`
if got != expected {
t.Errorf("Expected: %q, got: %q", expected, got)
}
Expand Down Expand Up @@ -104,19 +104,19 @@ func TestNoArgs(t *testing.T) {
func TestNoArgs_WithArgs(t *testing.T) {
c := getCommand(NoArgs, false)
_, err := executeCommand(c, "one")
noArgsWithArgs(err, t)
noArgsWithArgs(err, t, "one")
}

func TestNoArgs_WithValid_WithArgs(t *testing.T) {
c := getCommand(NoArgs, true)
_, err := executeCommand(c, "one")
noArgsWithArgs(err, t)
noArgsWithArgs(err, t, "one")
}

func TestNoArgs_WithValid_WithInvalidArgs(t *testing.T) {
c := getCommand(NoArgs, true)
_, err := executeCommand(c, "a")
noArgsWithArgs(err, t)
noArgsWithArgs(err, t, "a")
}

func TestNoArgs_WithValidOnly_WithInvalidArgs(t *testing.T) {
Expand Down

0 comments on commit 776257e

Please sign in to comment.