- changes, err := handle(tc.path, tc.line, tc.create)
- if !reflect.DeepEqual(tc.expChanges, changes) {
- t.Errorf("changes: %s",
- 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("err = %#v, want %#v",
- 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)