aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal/pkg/pkg_test.go
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2026-05-13 19:43:53 +0900
committerOphestra <cat@gensokyo.uk>2026-05-13 19:43:53 +0900
commita759cf3666897e97d8437cd1b74356d20c7cadca (patch)
tree35f002b899c594c2bdb853ae4d63ff9b82882ef8 /internal/pkg/pkg_test.go
parent8c2dd3e9848799ac8408b8322e3eba237ce37903 (diff)
internal/pkg: check exec substitution
This relies on the testtool having ident as relevant input to assert successful substitution. Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal/pkg/pkg_test.go')
-rw-r--r--internal/pkg/pkg_test.go23
1 files changed, 17 insertions, 6 deletions
diff --git a/internal/pkg/pkg_test.go b/internal/pkg/pkg_test.go
index 0877e791..d5c92a6d 100644
--- a/internal/pkg/pkg_test.go
+++ b/internal/pkg/pkg_test.go
@@ -246,26 +246,37 @@ func newDestroyArtifactFunc(a pkg.Artifact) func(
}
// destroyStatus counts non-substitution status entries and destroys them.
-func destroyStatus(t *testing.T, base *check.Absolute, n int) {
+func destroyStatus(t *testing.T, base *check.Absolute, c, s int) {
dents, err := os.ReadDir(base.Append("status").String())
if err != nil {
t.Fatal(err)
}
+ var gotC, gotS int
for _, dent := range dents {
- if !dent.Type().IsRegular() {
- t.Errorf("%s: %s", dent.Name(), dent.Type())
- }
if err = os.Remove(base.Append(
"status",
dent.Name(),
).String()); err != nil {
t.Fatal(err)
}
+
+ if dent.Type().IsRegular() {
+ gotC++
+ continue
+ }
+ if dent.Type()&fs.ModeSymlink == fs.ModeSymlink {
+ gotS++
+ continue
+ }
+ t.Errorf("%s: %s", dent.Name(), dent.Type())
}
- if len(dents) != n {
- t.Errorf("ReadDir: %d entries, want %d", len(dents), n)
+ if gotC != c {
+ t.Errorf("status: c = %d, want %d", gotC, c)
+ }
+ if gotS != s {
+ t.Errorf("status: s = %d, want %d", gotS, s)
}
}