Check paniced when using OneGenOf
vedujoshi opened this issue · comments
vedujoshi commented
Sometimes we get a failure with the below code
Error on property evaluation after 1 passed
tests: Check paniced: reflect: Call using *schema.PathMatcherType_Prefix
as type *schema.PathMatcherType_Path
Could you please suggest if you see any issue ?
Code:
func genPathMatcherType() gopter.Gen {
return gen.StructPtr(reflect.TypeOf(&pb_schema.PathMatcherType{}), map[string]gopter.Gen{
"PathMatch": gen.OneGenOf(genPathMatcherType_Prefix(), genPathMatcherType_Path(), genPathMatcherType_Regex()),
})
}
func genPathMatcherType_Prefix() gopter.Gen {
return gen.StructPtr(reflect.TypeOf(&pb_schema.PathMatcherType_Prefix{}), map[string]gopter.Gen{
"Prefix": gen.AlphaString(),
})
}
func genPathMatcherType_Path() gopter.Gen {
return gen.StructPtr(reflect.TypeOf(&pb_schema.PathMatcherType_Path{}), map[string]gopter.Gen{
"Path": gen.AlphaString(),
})
}
func genPathMatcherType_Regex() gopter.Gen {
return gen.StructPtr(reflect.TypeOf(&pb_schema.PathMatcherType_Regex{}), map[string]gopter.Gen{
"Regex": gen.AlphaString(),
})
}
Bodo Junglas commented
It looks right to me (provided the structs have these string fields).
Do you have more information where the panic occurs?