diff options
Diffstat (limited to 'internal/pkg/pkg_test.go')
| -rw-r--r-- | internal/pkg/pkg_test.go | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/internal/pkg/pkg_test.go b/internal/pkg/pkg_test.go index 0877e791..d5c92a6d 100644 --- a/internal/pkg/pkg_test.go +++ b/internal/pkg/pkg_test.go @@ -246,26 +246,37 @@ func newDestroyArtifactFunc(a pkg.Artifact) func( } // destroyStatus counts non-substitution status entries and destroys them. -func destroyStatus(t *testing.T, base *check.Absolute, n int) { +func destroyStatus(t *testing.T, base *check.Absolute, c, s int) { dents, err := os.ReadDir(base.Append("status").String()) if err != nil { t.Fatal(err) } + var gotC, gotS int for _, dent := range dents { - if !dent.Type().IsRegular() { - t.Errorf("%s: %s", dent.Name(), dent.Type()) - } if err = os.Remove(base.Append( "status", dent.Name(), ).String()); err != nil { t.Fatal(err) } + + if dent.Type().IsRegular() { + gotC++ + continue + } + if dent.Type()&fs.ModeSymlink == fs.ModeSymlink { + gotS++ + continue + } + t.Errorf("%s: %s", dent.Name(), dent.Type()) } - if len(dents) != n { - t.Errorf("ReadDir: %d entries, want %d", len(dents), n) + if gotC != c { + t.Errorf("status: c = %d, want %d", gotC, c) + } + if gotS != s { + t.Errorf("status: s = %d, want %d", gotS, s) } } |
