(t *testing.T)
| 1118 | } |
| 1119 | |
| 1120 | func TestUnHiddenDeprecatedFlagInDocs(t *testing.T) { |
| 1121 | f := getDeprecatedFlagSet() |
| 1122 | flg := f.Lookup("badflag") |
| 1123 | if flg == nil { |
| 1124 | t.Fatalf("Unable to lookup 'bob' in TestUnHiddenDeprecatedFlagInDocs") |
| 1125 | } |
| 1126 | flg.Hidden = false |
| 1127 | |
| 1128 | out := new(bytes.Buffer) |
| 1129 | f.SetOutput(out) |
| 1130 | f.PrintDefaults() |
| 1131 | |
| 1132 | defaults := out.String() |
| 1133 | if !strings.Contains(defaults, "badflag") { |
| 1134 | t.Errorf("Did not find deprecated flag in usage!") |
| 1135 | } |
| 1136 | if !strings.Contains(defaults, "use --good-flag instead") { |
| 1137 | t.Errorf("Did not find 'use --good-flag instead' in defaults") |
| 1138 | } |
| 1139 | } |
| 1140 | |
| 1141 | func TestDeprecatedFlagShorthandInDocs(t *testing.T) { |
| 1142 | f := NewFlagSet("bob", ContinueOnError) |
nothing calls this directly
no test coverage detected