Files
hakurei/internal/pkg/file_test.go
T
cat 67dbb68818
Test / Create distribution (push) Successful in 56s
Test / Sandbox (push) Successful in 2m43s
Test / ShareFS (push) Successful in 3m57s
Test / Hakurei (push) Successful in 4m3s
Test / Sandbox (race detector) (push) Successful in 5m34s
Test / Hakurei (race detector) (push) Successful in 6m36s
Test / Flake checks (push) Successful in 1m5s
internal/pkg: implementation revisions
This enables changing the behaviour of an artifact implementation without changing its IR structure. Unfortunately this changes the IR header structure resulting in many rebuilds.

Signed-off-by: Ophestra <cat@gensokyo.uk>
2026-07-23 16:39:34 +09:00

38 lines
1.0 KiB
Go

package pkg_test
import (
"io/fs"
"testing"
"hakurei.app/check"
"hakurei.app/internal/pkg"
)
func TestFile(t *testing.T) {
t.Parallel()
want := expectsFile{0}
checkWithCache(t, []cacheTestCase{
{"file", pkg.CValidateKnown, nil, func(t *testing.T, base *check.Absolute, c *pkg.Cache) {
cureMany(t, c, []cureStep{
{"short", pkg.NewFile("null", []byte{0}), base.Append(
"identifier",
"J3quqJoHNQID_k-amRdanjl0nXynlU7wzVJUx25BNvL229wxPyQ9s2Td9VbnRP6s",
), want, pkg.WNew, nil},
})
}, expectsFS{
".": {Mode: fs.ModeDir | 0700},
"checksum": {Mode: fs.ModeDir | 0700},
"checksum/" + pkg.Encode(want.hash()): {Mode: 0400, Data: []byte{0}},
"identifier": {Mode: fs.ModeDir | 0700},
"identifier/J3quqJoHNQID_k-amRdanjl0nXynlU7wzVJUx25BNvL229wxPyQ9s2Td9VbnRP6s": {Mode: fs.ModeSymlink | 0777, Data: []byte("../checksum/vsAhtPNo4waRNOASwrQwcIPTqb3SBuJOXw2G4T1mNmVZM-wrQTRllmgXqcIIoRcX")},
"substitute": {Mode: fs.ModeDir | 0700},
"work": {Mode: fs.ModeDir | 0700},
}},
})
}