mirror of
https://github.com/minio/minio.git
synced 2024-12-28 08:05:55 -05:00
ab3fd8ea7f
- Fix a new line issue for minioHelpTemplate. - Fixes #974
50 lines
1.0 KiB
Go
50 lines
1.0 KiB
Go
package cli_test
|
|
|
|
import (
|
|
"flag"
|
|
"testing"
|
|
|
|
"github.com/minio/cli"
|
|
)
|
|
|
|
func TestCommandDoNotIgnoreFlags(t *testing.T) {
|
|
app := cli.NewApp()
|
|
set := flag.NewFlagSet("test", 0)
|
|
test := []string{"blah", "blah", "-break"}
|
|
set.Parse(test)
|
|
|
|
c := cli.NewContext(app, set, set)
|
|
|
|
command := cli.Command{
|
|
Name: "test-cmd",
|
|
Aliases: []string{"tc"},
|
|
Usage: "this is for testing",
|
|
Description: "testing",
|
|
Action: func(_ *cli.Context) {},
|
|
}
|
|
err := command.Run(c)
|
|
|
|
expect(t, err.Error(), "flag provided but not defined: -break")
|
|
}
|
|
|
|
func TestCommandIgnoreFlags(t *testing.T) {
|
|
app := cli.NewApp()
|
|
set := flag.NewFlagSet("test", 0)
|
|
test := []string{"blah", "blah"}
|
|
set.Parse(test)
|
|
|
|
c := cli.NewContext(app, set, set)
|
|
|
|
command := cli.Command{
|
|
Name: "test-cmd",
|
|
Aliases: []string{"tc"},
|
|
Usage: "this is for testing",
|
|
Description: "testing",
|
|
Action: func(_ *cli.Context) {},
|
|
SkipFlagParsing: true,
|
|
}
|
|
err := command.Run(c)
|
|
|
|
expect(t, err, nil)
|
|
}
|