Make test case compatible with Go 1.17 (#1299)
* Make test case compatible with Go 1.17 * tweak test case to bring coverage back up
This commit is contained in:
parent
12b7dfd08c
commit
e8d8173889
@ -476,18 +476,18 @@ func TestApp_RunAsSubCommandIncorrectUsage(t *testing.T) {
|
|||||||
a := App{
|
a := App{
|
||||||
Name: "cmd",
|
Name: "cmd",
|
||||||
Flags: []Flag{
|
Flags: []Flag{
|
||||||
&StringFlag{Name: "--foo"},
|
&StringFlag{Name: "foo"},
|
||||||
},
|
},
|
||||||
Writer: bytes.NewBufferString(""),
|
Writer: bytes.NewBufferString(""),
|
||||||
}
|
}
|
||||||
|
|
||||||
set := flag.NewFlagSet("", flag.ContinueOnError)
|
set := flag.NewFlagSet("", flag.ContinueOnError)
|
||||||
_ = set.Parse([]string{"", "---foo"})
|
_ = set.Parse([]string{"", "-bar"})
|
||||||
c := &Context{flagSet: set}
|
c := &Context{flagSet: set}
|
||||||
|
|
||||||
err := a.RunAsSubcommand(c)
|
err := a.RunAsSubcommand(c)
|
||||||
|
|
||||||
expect(t, err, errors.New("bad flag syntax: ---foo"))
|
expect(t, err.Error(), "flag provided but not defined: -bar")
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestApp_CommandWithFlagBeforeTerminator(t *testing.T) {
|
func TestApp_CommandWithFlagBeforeTerminator(t *testing.T) {
|
||||||
|
Loading…
Reference in New Issue
Block a user