(t *testing.T)
| 602 | } |
| 603 | |
| 604 | func TestFlagInvalidInput(t *testing.T) { |
| 605 | rootCmd := &Command{Use: "root", Run: emptyRun} |
| 606 | rootCmd.Flags().IntP("intf", "i", -1, "") |
| 607 | |
| 608 | _, err := executeCommand(rootCmd, "-iabc") |
| 609 | if err == nil { |
| 610 | t.Errorf("Invalid flag value should generate error") |
| 611 | } |
| 612 | |
| 613 | checkStringContains(t, err.Error(), "invalid syntax") |
| 614 | } |
| 615 | |
| 616 | func TestFlagBeforeCommand(t *testing.T) { |
| 617 | rootCmd := &Command{Use: "root", Run: emptyRun} |
nothing calls this directly
no test coverage detected