8000 Fix:(issue_1114) Add test case for -- · urfave/cli@bb82056 · GitHub
[go: up one dir, main page]

Skip to content

Commit bb82056

Browse files
committed
Fix:(issue_1114) Add test case for --
1 parent c3fccc0 commit bb82056

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

app_test.go

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -813,6 +813,28 @@ func TestApp_CommandWithNoFlagBeforeTerminator(t *testing.T) {
813813
expect(t, args.Get(2), "notAFlagAtAll")
814814
}
815815

816+
func TestApp_CommandWithNoFlagImmediatelyBeforeTerminator(t *testing.T) {
817+
var args Args
818+
819+
app := &App{
820+
Commands: []*Command{
821+
{
822+
Name: "cmd",
823+
Action: func(c *Context) error {
824+
args = c.Args()
825+
return nil
826+
},
827+
},
828+
},
829+
}
830+
831+
_ = app.Run([]string{"", "cmd", "--", "my-arg", "notAFlagAtAll"})
832+
833+
expect(t, args.Get(0), "--")
834+
expect(t, args.Get(1), "my-arg")
835+
expect(t, args.Get(2), "notAFlagAtAll")
836+
}
837+
816838
func TestApp_VisibleCommands(t *testing.T) {
817839
app := &App{
818840
Commands: []*Command{

0 commit comments

Comments
 (0)
0