(t *testing.T)
| 1193 | } |
| 1194 | |
| 1195 | func TestDeprecatedFlagShorthandUsage(t *testing.T) { |
| 1196 | f := NewFlagSet("bob", ContinueOnError) |
| 1197 | name := "noshorthandflag" |
| 1198 | f.BoolP(name, "n", true, "always true") |
| 1199 | usageMsg := fmt.Sprintf("use --%s instead", name) |
| 1200 | f.MarkShorthandDeprecated(name, usageMsg) |
| 1201 | |
| 1202 | args := []string{"-n"} |
| 1203 | out, err := parseReturnStderr(t, f, args) |
| 1204 | if err != nil { |
| 1205 | t.Fatal("expected no error; got ", err) |
| 1206 | } |
| 1207 | |
| 1208 | if !strings.Contains(out, usageMsg) { |
| 1209 | t.Errorf("usageMsg not printed when using a deprecated flag!") |
| 1210 | } |
| 1211 | } |
| 1212 | |
| 1213 | func TestDeprecatedFlagUsageNormalized(t *testing.T) { |
| 1214 | f := NewFlagSet("bob", ContinueOnError) |
nothing calls this directly
no test coverage detected