formatDifferences formats a list of differences for display
(diffs []string)
| 372 | |
| 373 | // formatDifferences formats a list of differences for display |
| 374 | func formatDifferences(diffs []string) string { |
| 375 | if len(diffs) == 0 { |
| 376 | return "(none)" |
| 377 | } |
| 378 | result := "" |
| 379 | for i, diff := range diffs { |
| 380 | if i > 0 { |
| 381 | result += "\n " |
| 382 | } |
| 383 | result += diff |
| 384 | if i >= 5 { |
| 385 | result += fmt.Sprintf("\n ... and %d more differences", len(diffs)-5) |
| 386 | break |
| 387 | } |
| 388 | } |
| 389 | return result |
| 390 | } |
| 391 | |
| 392 | // mustExec executes a statement and fails the test on error |
| 393 | func mustExec(t *testing.T, db *sql.DB, query string) { |