MCPcopy Create free account
hub / github.com/couchbase/sync_gateway / TestAllConfigOptionsAsFlags

Function TestAllConfigOptionsAsFlags

rest/config_flags_test.go:151–156  ·  view source on GitHub ↗

Make sure the number of config options and number of flags match

(t *testing.T)

Source from the content-addressed store, hash-verified

149
150// Make sure the number of config options and number of flags match
151func TestAllConfigOptionsAsFlags(t *testing.T) {
152 cfg := NewEmptyStartupConfig()
153 cfgFieldsNum := countFields(cfg)
154 flagsNum := registerConfigFlags(&cfg, flag.NewFlagSet("test", flag.ContinueOnError))
155 assert.Lenf(t, flagsNum, cfgFieldsNum, "Number of cli flags and startup config properties did not match! Did you forget to add a new config option in registerConfigFlags?")
156}
157
158func countFields(cfg interface{}) (fields int) {
159 rField := reflect.ValueOf(cfg)

Callers

nothing calls this directly

Calls 3

NewEmptyStartupConfigFunction · 0.85
countFieldsFunction · 0.85
registerConfigFlagsFunction · 0.85

Tested by

no test coverage detected