(t *testing.T, s *schema.Schema, v *schema.Schema, primaryFields []string)
| 12 | ) |
| 13 | |
| 14 | func checkSchema(t *testing.T, s *schema.Schema, v *schema.Schema, primaryFields []string) { |
| 15 | t.Run("CheckSchema/"+s.Name, func(t *testing.T) { |
| 16 | tests.AssertObjEqual(t, s, v, "Name", "Table") |
| 17 | |
| 18 | for idx, field := range primaryFields { |
| 19 | var found bool |
| 20 | for _, f := range s.PrimaryFields { |
| 21 | if f.Name == field { |
| 22 | found = true |
| 23 | } |
| 24 | } |
| 25 | |
| 26 | if idx == 0 { |
| 27 | if field != s.PrioritizedPrimaryField.Name { |
| 28 | t.Errorf("schema %v prioritized primary field should be %v, but got %v", s, field, s.PrioritizedPrimaryField.Name) |
| 29 | } |
| 30 | } |
| 31 | |
| 32 | if !found { |
| 33 | t.Errorf("schema %v failed to found primary key: %v", s, field) |
| 34 | } |
| 35 | } |
| 36 | }) |
| 37 | } |
| 38 | |
| 39 | func checkSchemaField(t *testing.T, s *schema.Schema, f *schema.Field, fc func(*schema.Field)) { |
| 40 | t.Run("CheckField/"+f.Name, func(t *testing.T) { |
no test coverage detected