diff options
Diffstat (limited to 'internal/pkg/pkg_test.go')
| -rw-r--r-- | internal/pkg/pkg_test.go | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/internal/pkg/pkg_test.go b/internal/pkg/pkg_test.go index 2581cce7..903db563 100644 --- a/internal/pkg/pkg_test.go +++ b/internal/pkg/pkg_test.go @@ -47,10 +47,10 @@ type overrideIdent struct { func (a overrideIdent) ID() pkg.ID { return a.id } -// overrideIdentFile overrides the ID method of [File]. +// overrideIdentFile overrides the ID method of [FileArtifact]. type overrideIdentFile struct { id pkg.ID - pkg.File + pkg.FileArtifact } func (a overrideIdentFile) ID() pkg.ID { return a.id } @@ -61,10 +61,10 @@ type knownIdentArtifact interface { pkg.TrivialArtifact } -// A knownIdentFile implements [pkg.KnownIdent] and [File] +// A knownIdentFile implements [pkg.KnownIdent] and [FileArtifact] type knownIdentFile interface { pkg.KnownIdent - pkg.File + pkg.FileArtifact } // overrideChecksum overrides the Checksum method of [Artifact]. @@ -75,7 +75,7 @@ type overrideChecksum struct { func (a overrideChecksum) Checksum() pkg.Checksum { return a.checksum } -// overrideChecksumFile overrides the Checksum method of [File]. +// overrideChecksumFile overrides the Checksum method of [FileArtifact]. type overrideChecksumFile struct { checksum pkg.Checksum knownIdentFile @@ -111,7 +111,7 @@ func (a *stubArtifactF) Params(ctx *pkg.IContext) { ctx.GetHash().Write(a.pa func (a *stubArtifactF) Dependencies() []pkg.Artifact { return a.deps } func (a *stubArtifactF) Cure(f *pkg.FContext) error { return a.cure(f) } -// A stubFile implements [File] with hardcoded behaviour. +// A stubFile implements [FileArtifact] with hardcoded behaviour. type stubFile struct { data []byte err error @@ -119,7 +119,9 @@ type stubFile struct { stubArtifact } -func (a *stubFile) Cure(context.Context) ([]byte, error) { return a.data, a.err } +func (a *stubFile) Cure(context.Context) (io.ReadCloser, error) { + return io.NopCloser(bytes.NewReader(a.data)), a.err +} // newStubFile returns an implementation of [pkg.File] with hardcoded behaviour. func newStubFile( @@ -128,7 +130,7 @@ func newStubFile( sum *pkg.Checksum, data []byte, err error, -) pkg.File { +) pkg.FileArtifact { f := overrideIdentFile{id, &stubFile{data, err, stubArtifact{ kind, nil, |
