]> ruderich.org/simon Gitweb - safcm/safcm.git/blobdiff - cmd/safcm/sync_changes_test.go
tests: use subtests
[safcm/safcm.git] / cmd / safcm / sync_changes_test.go
index f48d441208e5f0bd8dc134b0e42b0a036abe5a00..767564fd14221a2c37405349b9bc867a777cdaa0 100644 (file)
@@ -283,6 +283,7 @@ func TestFormatFileChanges(t *testing.T) {
        }
 
        for _, tc := range tests {
+               t.Run(tc.name, func(t *testing.T) {
                s := &Sync{
                        config: &config.Config{
                                DryRun: tc.dryRun,
@@ -291,9 +292,10 @@ func TestFormatFileChanges(t *testing.T) {
 
                res := s.formatFileChanges(tc.changes)
                if tc.exp != res {
-                       t.Errorf("%s: res: %s", tc.name,
+                       t.Errorf("res: %s",
                                cmp.Diff(tc.exp, res))
                }
+               })
        }
 }
 
@@ -354,6 +356,7 @@ func TestFormatPackageChanges(t *testing.T) {
        }
 
        for _, tc := range tests {
+               t.Run(tc.name, func(t *testing.T) {
                s := &Sync{
                        config: &config.Config{
                                DryRun: tc.dryRun,
@@ -362,9 +365,10 @@ func TestFormatPackageChanges(t *testing.T) {
 
                res := s.formatPackageChanges(tc.changes)
                if tc.exp != res {
-                       t.Errorf("%s: res: %s", tc.name,
+                       t.Errorf("res: %s",
                                cmp.Diff(tc.exp, res))
                }
+               })
        }
 }
 
@@ -447,6 +451,7 @@ func TestFormatServiceChanges(t *testing.T) {
        }
 
        for _, tc := range tests {
+               t.Run(tc.name, func(t *testing.T) {
                s := &Sync{
                        config: &config.Config{
                                DryRun: tc.dryRun,
@@ -455,9 +460,10 @@ func TestFormatServiceChanges(t *testing.T) {
 
                res := s.formatServiceChanges(tc.changes)
                if tc.exp != res {
-                       t.Errorf("%s: res: %s", tc.name,
+                       t.Errorf("res: %s",
                                cmp.Diff(tc.exp, res))
                }
+               })
        }
 }
 
@@ -657,6 +663,7 @@ func TestFormatCommandChanges(t *testing.T) {
        }
 
        for _, tc := range tests {
+               t.Run(tc.name, func(t *testing.T) {
                s := &Sync{
                        config: &config.Config{
                                DryRun: tc.dryRun,
@@ -666,8 +673,9 @@ func TestFormatCommandChanges(t *testing.T) {
 
                res := s.formatCommandChanges(tc.changes)
                if tc.exp != res {
-                       t.Errorf("%s: res: %s", tc.name,
+                       t.Errorf("res: %s",
                                cmp.Diff(tc.exp, res))
                }
+               })
        }
 }