Update examples and tests for shared glossaries

This commit is contained in:
2026-11-27 17:00:16 +00:00
parent 410a4109ad
commit cfcb55e28c
38 changed files with 273 additions and 59 deletions

View File

@@ -472,7 +472,7 @@ inputs:
mustWriteTestFile(t, filepath.Join(campaignDir, "speakers.yml"), "match:\n - speaker: Alice\n match: [\"alice\"]\n")
mustWriteTestFile(t, filepath.Join(campaignDir, "autocorrect.yml"), "[]\n")
mustWriteTestFile(t, filepath.Join(campaignDir, "glossary.yml"), "[]\n")
mustWriteTestFile(t, filepath.Join(campaignDir, "glossary.yml"), "campaign: {entries: []}\n")
mustWriteTestFile(t, filepath.Join(campaignDir, "party.yml"), "schema_version: narratio.party.v1\ncharacters:\n arannis:\n player: {name: Eric}\n character:\n name: Arannis\n classes: [{name: wizard}]\n")
mustWriteTestFile(t, filepath.Join(dir, "audio", "alice.flac"), "audio-bytes")
@@ -702,12 +702,15 @@ func TestAuditaAppHelper(t *testing.T) {
os.Exit(2)
}
processArgs := args[start:]
if len(processArgs) < 2 || processArgs[0] != "process" {
_, _ = os.Stderr.WriteString("expected Audita v2 process invocation\n")
if len(processArgs) < 2 || (processArgs[0] != "process" && processArgs[0] != "preflight") {
_, _ = os.Stderr.WriteString("expected Audita process or preflight invocation\n")
os.Exit(2)
}
if processArgs[0] == "preflight" {
os.Exit(0)
}
for _, arg := range processArgs {
if arg == "--report-json" || arg == "--work-dir" || arg == "--debug" || arg == "--reporting=false" {
if arg == "--report-json" || arg == "--debug" || arg == "--reporting=false" {
_, _ = os.Stderr.WriteString("retired or unwanted Audita flag\n")
os.Exit(2)
}
@@ -726,8 +729,12 @@ func TestAuditaAppHelper(t *testing.T) {
_, _ = os.Stderr.WriteString(fmt.Sprintf("write output: %v\n", err))
os.Exit(2)
}
reportDir := appSeriatimFlagValue(processArgs, "--report-dir")
if err := os.MkdirAll(reportDir, 0o755); err != nil {
os.Exit(2)
}
for _, name := range []string{"errors.yml", "recoveries.yml", "report.md"} {
if err := os.WriteFile(filepath.Join(filepath.Dir(outputPath), name), []byte("status: completed\n"), 0o644); err != nil {
if err := os.WriteFile(filepath.Join(reportDir, name), []byte("status: completed\n"), 0o644); err != nil {
_, _ = os.Stderr.WriteString(fmt.Sprintf("write %s: %v\n", name, err))
os.Exit(2)
}