func getFieldNamesFromStruct(structDesc types.StructDesc) (fieldNames []string) { structDesc.IterFields(func(name string, t *types.Type) { d.Exp.True(types.IsPrimitiveKind(t.Kind())) fieldNames = append(fieldNames, name) }) return }
func (suite *ParserTestSuite) TestStructParse() { oneLine := "struct str { a :Bool b : Blob c: Blob }" suite.parseNotPanics(oneLine) noSpace := "struct str{a:Bool}" suite.parseNotPanics(noSpace) multiLine := "\nstruct str {\na :Bool\n}" suite.parseNotPanics(multiLine) for k, v := range types.KindToString { if types.IsPrimitiveKind(k) { suite.parseNotPanics(fmt.Sprintf(structTmpl, "s", "a :"+v, "")) } } }
func isPrimitiveOrRef(v1 types.Value) bool { kind := v1.Type().Kind() return types.IsPrimitiveKind(kind) || kind == types.RefKind }
func shouldDescend(v1, v2 types.Value) bool { kind := v1.Type().Kind() return !types.IsPrimitiveKind(kind) && kind == v2.Type().Kind() && kind != types.RefKind }