aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal/pkg/file_test.go
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2026-08-29 18:58:06 +0900
committerOphestra <cat@gensokyo.uk>2026-08-29 18:58:06 +0900
commitc2d900ec74e03e9c782cfe7b7ce06ff62cda6601 (patch)
treefb13320bfdc62d810aa59769e8809dc2f707919e /internal/pkg/file_test.go
parentbd4f29909e0750a4660eaf48e3169777a265b0ab (diff)
pkg: move from internalHEADstagingmasterdevelop
Closes #43. Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal/pkg/file_test.go')
-rw-r--r--internal/pkg/file_test.go56
1 files changed, 0 insertions, 56 deletions
diff --git a/internal/pkg/file_test.go b/internal/pkg/file_test.go
deleted file mode 100644
index f6fcc96f..00000000
--- a/internal/pkg/file_test.go
+++ /dev/null
@@ -1,56 +0,0 @@
-package pkg_test
-
-import (
- "io/fs"
- "testing"
-
- "hakurei.app/check"
- "hakurei.app/internal/pkg"
-)
-
-func TestFile(t *testing.T) {
- t.Parallel()
-
- want := expectsFile{0}
- const ident = "N7M6W8-e55Wky_1q1a6qRKFVDw1S5XtPdB4HE2YZObG8OFum8HittyJgZUG5Ru2u"
- wantShebang := expectsFile("#!/bin/sh\n")
- const identShebang = "oKTGZb_TRtJf5G1iGGj4SOx1WUbI6YhmsUeEsCNvmK9tZYRwdwQf-DLFUxRPx5qm"
- wantELF := expectsFile("\x7fELF\xde\xad\xbe\xef")
- const identELF = "LjeHmIJgD1SiXIH8ewpGRed2_LU84NLapstnOAa_0hxLd8YY7x4KM0aApsj-RwCh"
- 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", want), base.Append(
- "identifier",
- ident,
- ), want, pkg.WNew, nil},
-
- {"shebang", pkg.NewFile("shebang", wantShebang), base.Append(
- "identifier",
- identShebang,
- ), wantShebang, pkg.WNew, nil},
-
- {"elf", pkg.NewFile("ELF", wantELF), base.Append(
- "identifier",
- identELF,
- ), wantELF, pkg.WNew, nil},
- })
- }, expectsFS{
- ".": {Mode: fs.ModeDir | 0700},
-
- "checksum": {Mode: fs.ModeDir | 0700},
- "checksum/" + pkg.Encode(want.hash()): {Mode: 0400, Data: want},
- "checksum/" + pkg.Encode(wantShebang.hash()): {Mode: 0500, Data: wantShebang},
- "checksum/" + pkg.Encode(wantELF.hash()): {Mode: 0500, Data: wantELF},
-
- "identifier": {Mode: fs.ModeDir | 0700},
- "identifier/" + ident: {Mode: fs.ModeSymlink | 0777, Data: []byte("../checksum/" + pkg.Encode(want.hash()))},
- "identifier/" + identShebang: {Mode: fs.ModeSymlink | 0777, Data: []byte("../checksum/" + pkg.Encode(wantShebang.hash()))},
- "identifier/" + identELF: {Mode: fs.ModeSymlink | 0777, Data: []byte("../checksum/" + pkg.Encode(wantELF.hash()))},
-
- "substitute": {Mode: fs.ModeDir | 0700},
-
- "work": {Mode: fs.ModeDir | 0700},
- }},
- })
-}