Name normalization function should be called only once on flag addition
(t *testing.T)
| 1230 | |
| 1231 | // Name normalization function should be called only once on flag addition |
| 1232 | func TestMultipleNormalizeFlagNameInvocations(t *testing.T) { |
| 1233 | normalizeFlagNameInvocations = 0 |
| 1234 | |
| 1235 | f := NewFlagSet("normalized", ContinueOnError) |
| 1236 | f.SetNormalizeFunc(wordSepNormalizeFunc) |
| 1237 | f.Bool("with_under_flag", false, "bool value") |
| 1238 | |
| 1239 | if normalizeFlagNameInvocations != 1 { |
| 1240 | t.Fatal("Expected normalizeFlagNameInvocations to be 1; got ", normalizeFlagNameInvocations) |
| 1241 | } |
| 1242 | } |
| 1243 | |
| 1244 | func TestHiddenFlagInUsage(t *testing.T) { |
| 1245 | f := NewFlagSet("bob", ContinueOnError) |
nothing calls this directly
no test coverage detected