X-Git-Url: https://ruderich.org/simon/gitweb/?a=blobdiff_plain;f=cmd%2Fsafcm-remote%2Fainsl%2Fainsl_test.go;h=2526dca0860da6685453c29e6e36e6d5dddfac98;hb=3473766d8afb07cb0685694656947883cbbd1138;hp=564bc37d99fde46e81ebbe305d27ee838d59b5f1;hpb=641203fda8f7da72c74562c9dc910ca108116f11;p=safcm%2Fsafcm.git diff --git a/cmd/safcm-remote/ainsl/ainsl_test.go b/cmd/safcm-remote/ainsl/ainsl_test.go index 564bc37..2526dca 100644 --- a/cmd/safcm-remote/ainsl/ainsl_test.go +++ b/cmd/safcm-remote/ainsl/ainsl_test.go @@ -20,13 +20,11 @@ import ( "io/fs" "os" "path/filepath" - "reflect" "syscall" "testing" - "github.com/google/go-cmp/cmp" - ft "ruderich.org/simon/safcm/cmd/safcm-remote/sync/filetest" + "ruderich.org/simon/safcm/testutil" ) func TestHandle(t *testing.T) { @@ -310,24 +308,15 @@ func TestHandle(t *testing.T) { } 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) - } + testutil.AssertEqual(t, "changes", + changes, tc.expChanges) + testutil.AssertErrorEqual(t, "err", err, tc.expErr) files, err := ft.WalkDir(path) if err != nil { t.Fatal(err) } - if !reflect.DeepEqual(tc.expFiles, files) { - t.Errorf("files: %s", - cmp.Diff(tc.expFiles, files)) - } + testutil.AssertEqual(t, "files", files, tc.expFiles) }) }