Skip to content

Commit

Permalink
Fix:(issue_1114) Add test case for --
Browse files Browse the repository at this point in the history
  • Loading branch information
dearchap committed Nov 1, 2022
1 parent ae8d932 commit 4a000ab
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions app_test.go
Expand Up @@ -790,6 +790,28 @@ func TestApp_CommandWithNoFlagBeforeTerminator(t *testing.T) {
expect(t, args.Get(2), "notAFlagAtAll")
}

func TestApp_CommandWithNoFlagImmediatelyBeforeTerminator(t *testing.T) {
var args Args

app := &App{
Commands: []*Command{
{
Name: "cmd",
Action: func(c *Context) error {
args = c.Args()
return nil
},
},
},
}

_ = app.Run([]string{"", "cmd", "--", "my-arg", "notAFlagAtAll"})

expect(t, args.Get(0), "--")
expect(t, args.Get(1), "my-arg")
expect(t, args.Get(2), "notAFlagAtAll")
}

func TestApp_VisibleCommands(t *testing.T) {
app := &App{
Commands: []*Command{
Expand Down

0 comments on commit 4a000ab

Please sign in to comment.