Fix:(issue_1114) Add test case for --
This commit is contained in:
parent
c3fccc031b
commit
bb820560d9
22
app_test.go
22
app_test.go
@ -813,6 +813,28 @@ func TestApp_CommandWithNoFlagBeforeTerminator(t *testing.T) {
|
|||||||
expect(t, args.Get(2), "notAFlagAtAll")
|
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) {
|
func TestApp_VisibleCommands(t *testing.T) {
|
||||||
app := &App{
|
app := &App{
|
||||||
Commands: []*Command{
|
Commands: []*Command{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user