|
1 | 1 | package main |
2 | 2 |
|
3 | 3 | import ( |
4 | | - "fmt" |
5 | 4 | "testing" |
6 | 5 | "time" |
7 | 6 |
|
@@ -35,51 +34,57 @@ func TestDocumentRecords(t *testing.T) { |
35 | 34 | if err != nil { |
36 | 35 | t.Fatal(err) |
37 | 36 | } |
38 | | - |
39 | | - if err := assertDocEqual(d, dpiped); err != nil { |
40 | | - t.Errorf("piped document differs: %s", err) |
41 | | - } |
| 37 | + assertDocEqual(t, d, dpiped) |
42 | 38 | } |
43 | 39 |
|
44 | | -func assertDocEqual(a, b document) error { |
| 40 | +func assertDocEqual(t *testing.T, a, b document) error { |
| 41 | + if len(a.Revisions) == len(b.Revisions) { |
| 42 | + for i := range a.Revisions { |
| 43 | + if a.Revisions[i] != b.Revisions[i] { |
| 44 | + t.Errorf("%dth revision not equal %s,%s", i, a.Revisions[i], b.Revisions[i]) |
| 45 | + } |
| 46 | + } |
| 47 | + } else { |
| 48 | + t.Error("revisions lengths unequal") |
| 49 | + } |
45 | 50 | if a.Revision() != b.Revision() { |
46 | | - return fmt.Errorf("Revision not equal %q, %q", a.Revision(), b.Revision()) |
| 51 | + t.Errorf("Revision not equal %q, %q", a.Revision(), b.Revision()) |
47 | 52 | } |
48 | 53 | if a.Location != b.Location { |
49 | | - return fmt.Errorf("Location not equal %q, %q", a.Location, b.Location) |
| 54 | + t.Errorf("Location not equal %q, %q", a.Location, b.Location) |
50 | 55 | } |
51 | 56 | if a.SubmittedBy != b.SubmittedBy { |
52 | | - return fmt.Errorf("SubmittedBy not equal %q, %q", a.SubmittedBy, b.SubmittedBy) |
| 57 | + t.Errorf("SubmittedBy not equal %q, %q", a.SubmittedBy, b.SubmittedBy) |
53 | 58 | } |
54 | 59 | if a.Number != b.Number { |
55 | | - return fmt.Errorf("Number not equal %d, %d", a.Number, b.Number) |
| 60 | + t.Errorf("Number not equal %d, %d", a.Number, b.Number) |
56 | 61 | } |
57 | 62 | if a.FileExtension != b.FileExtension { |
58 | | - return fmt.Errorf("FileExtension not equal %q, %q", a.FileExtension, b.FileExtension) |
| 63 | + t.Errorf("FileExtension not equal %q, %q", a.FileExtension, b.FileExtension) |
59 | 64 | } |
60 | 65 | if a.Project != b.Project { |
61 | | - return fmt.Errorf("project not equal %q, %q", a.Project, b.Project) |
| 66 | + t.Errorf("project not equal %q, %q", a.Project, b.Project) |
62 | 67 | } |
63 | 68 | if a.DocType != b.DocType { |
64 | | - return fmt.Errorf("DocType not equal %q, %q", a.DocType, b.DocType) |
| 69 | + t.Errorf("DocType not equal %q, %q", a.DocType, b.DocType) |
65 | 70 | } |
66 | 71 | if a.Attachment != b.Attachment { |
67 | | - return fmt.Errorf("Attachment not equal %d, %d", a.Attachment, b.Attachment) |
| 72 | + t.Errorf("Attachment not equal %d, %d", a.Attachment, b.Attachment) |
68 | 73 | } |
69 | 74 | if a.Created != b.Created { |
70 | | - return fmt.Errorf("Created not equal %q, %q", a.Created, b.Created) |
| 75 | + t.Errorf("Created not equal %q, %q", a.Created, b.Created) |
71 | 76 | } |
72 | 77 | if a.Revised != b.Revised { |
73 | | - return fmt.Errorf("Revised not equal %q, %q", a.Revised, b.Revised) |
| 78 | + t.Errorf("Revised not equal %q, %q", a.Revised, b.Revised) |
74 | 79 | } |
75 | 80 | if a.Deleted != b.Deleted { |
76 | | - return fmt.Errorf("deleted not equal %t, %t", a.Deleted, b.Deleted) |
| 81 | + t.Errorf("deleted not equal %t, %t", a.Deleted, b.Deleted) |
77 | 82 | } |
78 | 83 | if a.HumanName != b.HumanName { |
79 | | - return fmt.Errorf("HumanName not equal %q, %q", a.HumanName, b.HumanName) |
| 84 | + t.Errorf("HumanName not equal %q, %q", a.HumanName, b.HumanName) |
80 | 85 | } |
81 | 86 | if a.Equipment != b.Equipment { |
82 | | - return fmt.Errorf("Equipment not equal %q, %q", a.Equipment, b.Equipment) |
| 87 | + t.Errorf("Equipment not equal %q, %q", a.Equipment, b.Equipment) |
83 | 88 | } |
84 | 89 | return nil |
85 | 90 | } |
0 commit comments