fix fragile hak packing (#36)
test / test (push) Successful in 1m25s
build-binaries / build-binaries (push) Successful in 2m9s
build-image / publish (push) Successful in 57s

Reviewed-on: #36
Reviewed-by: xtul <mpiasecki720@protonmail.com>
Co-authored-by: vickydotbat <vickydotbat@tutamail.com>
Co-committed-by: vickydotbat <vickydotbat@tutamail.com>
This commit was merged in pull request #36.
This commit is contained in:
2026-07-10 08:59:07 +00:00
committed by archvillainette
parent 754375fb08
commit 825fff8b67
3 changed files with 80 additions and 18 deletions
+54
View File
@@ -15116,6 +15116,60 @@ func writeBytes(t *testing.T, path string, content []byte) {
}
}
func TestSkipTopPackageAsset(t *testing.T) {
skipped := []string{
"gui/regions/comfyui-generate.sh", // non-NWN extension
"gui/regions/_candidates/abyss.opt4.png",
"gui/.hidden/banner.png",
"gui/.DS_Store",
"gui/AGENTS.md",
"gui/noextension",
}
kept := []string{
"gui/regions/abyss.png",
"2da-src/placeables.2da",
"tex/floor01.dds",
}
for _, rel := range skipped {
if !skipTopPackageAsset(rel) {
t.Errorf("expected %s to be skipped", rel)
}
}
for _, rel := range kept {
if skipTopPackageAsset(rel) {
t.Errorf("expected %s to be kept", rel)
}
}
}
func TestValidateTopPackageAssetsIgnoresNonNWNFiles(t *testing.T) {
dir := t.TempDir()
assets := filepath.Join(dir, "assets", "gui", "regions")
candidates := filepath.Join(assets, "_candidates")
if err := os.MkdirAll(candidates, 0o755); err != nil {
t.Fatal(err)
}
for path, content := range map[string]string{
filepath.Join(assets, "comfyui-generate.sh"): "#!/bin/sh",
filepath.Join(assets, "abyss.png"): "png",
filepath.Join(candidates, "abyss.opt4.png"): "png",
filepath.Join(candidates, "notes.txt.backup"): "junk",
} {
if err := os.WriteFile(path, []byte(content), 0o644); err != nil {
t.Fatal(err)
}
}
dataDir := filepath.Join(dir, "data")
if err := os.MkdirAll(dataDir, 0o755); err != nil {
t.Fatal(err)
}
var report ValidationReport
validateTopPackageAssets(dir, dataDir, &report)
for _, d := range report.Diagnostics {
t.Errorf("unexpected diagnostic: %s: %s", d.Path, d.Message)
}
}
func TestValidateTopPackageAssetsSkipsMarkdown(t *testing.T) {
dir := t.TempDir()
assets := filepath.Join(dir, "assets", "gui")