(t *testing.T)
| 1211 | } |
| 1212 | |
| 1213 | func TestDeprecatedFlagUsageNormalized(t *testing.T) { |
| 1214 | f := NewFlagSet("bob", ContinueOnError) |
| 1215 | f.Bool("bad-double_flag", true, "always true") |
| 1216 | f.SetNormalizeFunc(wordSepNormalizeFunc) |
| 1217 | usageMsg := "use --good-flag instead" |
| 1218 | f.MarkDeprecated("bad_double-flag", usageMsg) |
| 1219 | |
| 1220 | args := []string{"--bad_double_flag"} |
| 1221 | out, err := parseReturnStderr(t, f, args) |
| 1222 | if err != nil { |
| 1223 | t.Fatal("expected no error; got ", err) |
| 1224 | } |
| 1225 | |
| 1226 | if !strings.Contains(out, usageMsg) { |
| 1227 | t.Errorf("usageMsg not printed when using a deprecated flag!") |
| 1228 | } |
| 1229 | } |
| 1230 | |
| 1231 | // Name normalization function should be called only once on flag addition |
| 1232 | func TestMultipleNormalizeFlagNameInvocations(t *testing.T) { |
nothing calls this directly
no test coverage detected
searching dependent graphs…