diff options
Diffstat (limited to 'internal/pkg/pkg_test.go')
| -rw-r--r-- | internal/pkg/pkg_test.go | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/internal/pkg/pkg_test.go b/internal/pkg/pkg_test.go index dca39324..e089b9a3 100644 --- a/internal/pkg/pkg_test.go +++ b/internal/pkg/pkg_test.go @@ -23,6 +23,8 @@ import ( "hakurei.app/internal/pkg" ) +func TestMain(m *testing.M) { container.TryArgv0(nil); os.Exit(m.Run()) } + // overrideIdent overrides the ID method of [Artifact]. type overrideIdent struct { id pkg.ID @@ -251,13 +253,16 @@ type cureStep struct { err error } +// ignorePathname is passed to cureMany to skip the pathname check. +var ignorePathname = check.MustAbs("/\x00") + // cureMany cures many artifacts against a [Cache] and checks their outcomes. func cureMany(t *testing.T, c *pkg.Cache, steps []cureStep) { 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 !pathname.Is(step.pathname) { + } 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)) |
