aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal/pkg/pkg_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/pkg/pkg_test.go')
-rw-r--r--internal/pkg/pkg_test.go22
1 files changed, 18 insertions, 4 deletions
diff --git a/internal/pkg/pkg_test.go b/internal/pkg/pkg_test.go
index 6717869d..727a6c36 100644
--- a/internal/pkg/pkg_test.go
+++ b/internal/pkg/pkg_test.go
@@ -159,7 +159,7 @@ func destroyArtifact(
} else {
p := base.Append(
"checksum",
- pkg.Encode(checksum),
+ pkg.Encode(checksum.Value()),
)
if err = filepath.WalkDir(p.String(), func(
path string,
@@ -362,20 +362,34 @@ var ignorePathname = check.MustAbs("/\x00")
func cureMany(t *testing.T, c *pkg.Cache, steps []cureStep) {
t.Helper()
+ makeChecksumH := func(checksum pkg.Checksum) unique.Handle[pkg.Checksum] {
+ if checksum == (pkg.Checksum{}) {
+ return unique.Handle[pkg.Checksum]{}
+ }
+ return unique.Make(checksum)
+ }
+
for _, step := range steps {
t.Log("cure step:", step.name)
if pathname, checksum, err := c.Cure(step.a); !reflect.DeepEqual(err, step.err) {
t.Fatalf("Cure: error = %v, want %v", err, step.err)
} else if step.pathname != ignorePathname && !pathname.Is(step.pathname) {
t.Fatalf("Cure: pathname = %q, want %q", pathname, step.pathname)
- } else if checksum != step.checksum {
- t.Fatalf("Cure: checksum = %s, want %s", pkg.Encode(checksum), pkg.Encode(step.checksum))
+ } else if checksum != makeChecksumH(step.checksum) {
+ t.Fatalf(
+ "Cure: checksum = %s, want %s",
+ pkg.Encode(checksum.Value()), pkg.Encode(step.checksum),
+ )
} else {
v := any(err)
if err == nil {
v = pathname
}
- t.Log(pkg.Encode(checksum)+":", v)
+ var checksumVal pkg.Checksum
+ if checksum != (unique.Handle[pkg.Checksum]{}) {
+ checksumVal = checksum.Value()
+ }
+ t.Log(pkg.Encode(checksumVal)+":", v)
}
}
}