- changes, err := handle(tc.path, tc.line, tc.create)
- if !reflect.DeepEqual(tc.expChanges, changes) {
- t.Errorf("%s: changes: %s", tc.name,
- cmp.Diff(tc.expChanges, changes))
- }
- // Ugly but the simplest way to compare errors (including nil)
- if fmt.Sprintf("%s", err) != fmt.Sprintf("%s", tc.expErr) {
- t.Errorf("%s: err = %#v, want %#v",
- tc.name, err, tc.expErr)
- }
+ changes, err := handle(tc.path, tc.line, tc.create)
+ testutil.AssertEqual(t, "changes",
+ changes, tc.expChanges)
+ testutil.AssertErrorEqual(t, "err", err, tc.expErr)