linter fixes
code cleanup changing some test code to ensure uniformity
This commit is contained in:
@@ -35,7 +35,7 @@ func TestCommandFlagParsing(t *testing.T) {
|
||||
app := NewApp()
|
||||
app.Writer = ioutil.Discard
|
||||
set := flag.NewFlagSet("test", 0)
|
||||
set.Parse(c.testArgs)
|
||||
_ = set.Parse(c.testArgs)
|
||||
|
||||
context := NewContext(app, set, nil)
|
||||
|
||||
@@ -59,9 +59,9 @@ func TestCommandFlagParsing(t *testing.T) {
|
||||
|
||||
func TestParseAndRunShortOpts(t *testing.T) {
|
||||
cases := []struct {
|
||||
testArgs []string
|
||||
expectedErr error
|
||||
expectedArgs []string
|
||||
testArgs []string
|
||||
expectedErr error
|
||||
expectedArgs []string
|
||||
}{
|
||||
{[]string{"foo", "test", "-a"}, nil, []string{}},
|
||||
{[]string{"foo", "test", "-c", "arg1", "arg2"}, nil, []string{"arg1", "arg2"}},
|
||||
@@ -71,18 +71,18 @@ func TestParseAndRunShortOpts(t *testing.T) {
|
||||
{[]string{"foo", "test", "-cf"}, nil, []string{}},
|
||||
{[]string{"foo", "test", "-acf"}, nil, []string{}},
|
||||
{[]string{"foo", "test", "-invalid"}, errors.New("flag provided but not defined: -invalid"), []string{}},
|
||||
{[]string{"foo", "test", "-acf", "arg1", "-invalid"}, nil, []string{"arg1" ,"-invalid"}},
|
||||
{[]string{"foo", "test", "-acf", "arg1", "-invalid"}, nil, []string{"arg1", "-invalid"}},
|
||||
}
|
||||
|
||||
var args []string
|
||||
cmd := Command{
|
||||
Name: "test",
|
||||
Usage: "this is for testing",
|
||||
Description: "testing",
|
||||
Action: func(c *Context) error {
|
||||
args = c.Args()
|
||||
return nil
|
||||
},
|
||||
Name: "test",
|
||||
Usage: "this is for testing",
|
||||
Description: "testing",
|
||||
Action: func(c *Context) error {
|
||||
args = c.Args()
|
||||
return nil
|
||||
},
|
||||
SkipArgReorder: true,
|
||||
UseShortOptionHandling: true,
|
||||
Flags: []Flag{
|
||||
@@ -304,7 +304,7 @@ func TestCommandFlagReordering(t *testing.T) {
|
||||
|
||||
for _, c := range cases {
|
||||
value := ""
|
||||
args := []string{}
|
||||
var args []string
|
||||
app := &App{
|
||||
Commands: []Command{
|
||||
{
|
||||
@@ -339,7 +339,7 @@ func TestCommandSkipFlagParsing(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, c := range cases {
|
||||
args := []string{}
|
||||
var args []string
|
||||
app := &App{
|
||||
Commands: []Command{
|
||||
{
|
||||
|
Reference in New Issue
Block a user