(t *testing.T)
| 107 | } |
| 108 | |
| 109 | func TestUsage(t *testing.T) { |
| 110 | called := false |
| 111 | ResetForTesting(func() { called = true }) |
| 112 | err := GetCommandLine().Parse([]string{"--x"}) |
| 113 | expectedErr := "unknown flag: --x" |
| 114 | if err == nil { |
| 115 | t.Error("parse did not fail for unknown flag") |
| 116 | } |
| 117 | if err.Error() != expectedErr { |
| 118 | t.Errorf("expected error %q, got %q", expectedErr, err.Error()) |
| 119 | } |
| 120 | if called { |
| 121 | t.Error("did call Usage while using ContinueOnError") |
| 122 | } |
| 123 | } |
| 124 | |
| 125 | func TestAddFlagSet(t *testing.T) { |
| 126 | oldSet := NewFlagSet("old", ContinueOnError) |
nothing calls this directly
no test coverage detected