2019-10-29 15:30:14 +00:00
|
|
|
package featureconfig
|
|
|
|
|
|
|
|
import (
|
|
|
|
"reflect"
|
2019-10-29 17:28:41 +00:00
|
|
|
"strings"
|
2019-10-29 15:30:14 +00:00
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestDeprecatedFlags(t *testing.T) {
|
|
|
|
for _, f := range deprecatedFlags {
|
|
|
|
fv := reflect.ValueOf(f)
|
2020-03-19 21:46:44 +00:00
|
|
|
field := reflect.Indirect(fv).FieldByName("Hidden")
|
|
|
|
if !field.IsValid() || !field.Bool() {
|
|
|
|
t.Errorf("%s must be hidden when deprecated.", f.Names()[0])
|
2019-10-29 15:30:14 +00:00
|
|
|
}
|
2020-03-19 21:46:44 +00:00
|
|
|
if !strings.Contains(reflect.Indirect(fv).FieldByName("Usage").String(), "DEPRECATED. DO NOT USE.") {
|
|
|
|
t.Errorf("Usage for %s must contain \"DEPRECATED. DO NOT USE.\"", f.Names()[0])
|
2019-10-29 17:28:41 +00:00
|
|
|
}
|
2019-10-29 15:30:14 +00:00
|
|
|
}
|
|
|
|
}
|