]> ruderich.org/simon Gitweb - safcm/safcm.git/blobdiff - cmd/safcm/sync_sync_test.go
tests: use subtests
[safcm/safcm.git] / cmd / safcm / sync_sync_test.go
index f6aafd52445e6664f4958ab82703736a51e93982..65a490a298518963326cf3597fd720e4e82ddbc0 100644 (file)
@@ -419,6 +419,7 @@ func TestHostSyncReq(t *testing.T) {
        }
 
        for _, tc := range tests {
+               t.Run(tc.name, func(t *testing.T) {
                err = os.Chdir(filepath.Join(cwd, "testdata", tc.project))
                if err != nil {
                        t.Fatal(err)
@@ -469,21 +470,21 @@ func TestHostSyncReq(t *testing.T) {
 
                res, err := s.hostSyncReq(tc.detected)
                if !reflect.DeepEqual(tc.exp, res) {
-                       t.Errorf("%s: res: %s", tc.name,
+                       t.Errorf("res: %s",
                                cmp.Diff(tc.exp, res))
                }
                // 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)
+                       t.Errorf("err = %#v, want %#v",
+                               err, tc.expErr)
                }
 
                close(ch)
                <-done
                if !reflect.DeepEqual(tc.expEvents, events) {
-                       t.Errorf("%s: events: %s", tc.name,
+                       t.Errorf("events: %s",
                                cmp.Diff(tc.expEvents, events))
                }
-
+               })
        }
 }