forked from rosa/hakurei
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>
38 lines
1.0 KiB
Go
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},
|
|
}},
|
|
})
|
|
}
|