Skip to content

Check paniced when using OneGenOf #83

@vedujoshi

Description

@vedujoshi

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(),
	})
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions