(t *testing.T, expected, actual []*schema.Index)
| 252 | } |
| 253 | |
| 254 | func CheckIndices(t *testing.T, expected, actual []*schema.Index) { |
| 255 | if len(expected) != len(actual) { |
| 256 | t.Errorf("expected %d indices, but got %d", len(expected), len(actual)) |
| 257 | return |
| 258 | } |
| 259 | |
| 260 | for i, ei := range expected { |
| 261 | t.Run(ei.Name, func(t *testing.T) { |
| 262 | ai := actual[i] |
| 263 | tests.AssertObjEqual(t, ai, ei, "Name", "Class", "Type", "Where", "Comment", "Option") |
| 264 | |
| 265 | if len(ei.Fields) != len(ai.Fields) { |
| 266 | t.Errorf("expected index %q field length is %d but actual %d", ei.Name, len(ei.Fields), len(ai.Fields)) |
| 267 | return |
| 268 | } |
| 269 | for i, ef := range ei.Fields { |
| 270 | af := ai.Fields[i] |
| 271 | tests.AssertObjEqual(t, af, ef, "Name", "Unique", "UniqueIndex", "Expression", "Sort", "Collate", "Length", "NotNull") |
| 272 | } |
| 273 | }) |
| 274 | } |
| 275 | } |
no test coverage detected