diff options
| author | Ophestra <cat@gensokyo.uk> | 2026-01-03 22:02:15 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2026-01-03 22:03:25 +0900 |
| commit | 863d3dcf9f51015f800a26c5dc63576f114d4380 (patch) | |
| tree | 4d1131f7fb2b34e0cd568296e5d0d8f2a42d81d5 /internal/pkg/pkg_test.go | |
| parent | 8ad990906555d843d1212c5eb8a1ac194031426c (diff) | |
internal/pkg: wrap checksum string encoding
This wraps base64.URLEncoding.EncodeToString for cleaner call site.
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal/pkg/pkg_test.go')
| -rw-r--r-- | internal/pkg/pkg_test.go | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/internal/pkg/pkg_test.go b/internal/pkg/pkg_test.go index 1151a681..f295ef0b 100644 --- a/internal/pkg/pkg_test.go +++ b/internal/pkg/pkg_test.go @@ -3,7 +3,6 @@ package pkg_test import ( "bytes" "crypto/sha512" - "encoding/base64" "io/fs" "net/http" "os" @@ -51,8 +50,8 @@ func TestIdent(t *testing.T) { if got := tc.kind.Ident(tc.params, tc.deps...); got != tc.want { t.Errorf("Ident: %s, want %s", - base64.URLEncoding.EncodeToString(got[:]), - base64.URLEncoding.EncodeToString(tc.want[:])) + pkg.Encode(got), + pkg.Encode(tc.want)) } }) } @@ -132,7 +131,7 @@ func TestCache(t *testing.T) { return (pkg.Checksum)(h.Sum(nil)) }() - testdataChecksumString := base64.URLEncoding.EncodeToString(testdataChecksum[:]) + testdataChecksumString := pkg.Encode(testdataChecksum) testCases := []cacheTestCase{ {"file", nil, func(t *testing.T, base *check.Absolute, c *pkg.Cache) { @@ -267,7 +266,7 @@ func TestCache(t *testing.T) { var gotChecksum pkg.Checksum wantPathnameG := base.Append( "identifier", - base64.URLEncoding.EncodeToString(wantChecksum[:]), + pkg.Encode(wantChecksum), ) if pathname, err := c.StoreFile( wantChecksum, |
