(t *testing.T)
| 1139 | } |
| 1140 | |
| 1141 | func TestDeprecatedFlagShorthandInDocs(t *testing.T) { |
| 1142 | f := NewFlagSet("bob", ContinueOnError) |
| 1143 | name := "noshorthandflag" |
| 1144 | f.BoolP(name, "n", true, "always true") |
| 1145 | f.MarkShorthandDeprecated("noshorthandflag", fmt.Sprintf("use --%s instead", name)) |
| 1146 | |
| 1147 | out := new(bytes.Buffer) |
| 1148 | f.SetOutput(out) |
| 1149 | f.PrintDefaults() |
| 1150 | |
| 1151 | if strings.Contains(out.String(), "-n,") { |
| 1152 | t.Errorf("found deprecated flag shorthand in usage!") |
| 1153 | } |
| 1154 | } |
| 1155 | |
| 1156 | func parseReturnStderr(t *testing.T, f *FlagSet, args []string) (string, error) { |
| 1157 | oldStderr := os.Stderr |
nothing calls this directly
no test coverage detected