MCPcopy Create free account
hub / github.com/CPChain/chain / makeMapFromTestFunc

Function makeMapFromTestFunc

tests/init_test.go:237–247  ·  view source on GitHub ↗
(f interface{})

Source from the content-addressed store, hash-verified

235}
236
237func makeMapFromTestFunc(f interface{}) reflect.Value {
238 stringT := reflect.TypeOf("")
239 testingT := reflect.TypeOf((*testing.T)(nil))
240 ftyp := reflect.TypeOf(f)
241 if ftyp.Kind() != reflect.Func || ftyp.NumIn() != 3 || ftyp.NumOut() != 0 || ftyp.In(0) != testingT || ftyp.In(1) != stringT {
242 panic(fmt.Sprintf("bad test function type: want func(*testing.T, string, <TestType>), have %s", ftyp))
243 }
244 testType := ftyp.In(2)
245 mp := reflect.New(reflect.MapOf(stringT, testType))
246 return mp.Elem()
247}
248
249func sortedMapKeys(m reflect.Value) []string {
250 keys := make([]string, m.Len())

Callers 1

runTestFileMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected