Explicit masterfeats/feats removal

This commit is contained in:
2026-05-13 19:32:41 +02:00
parent 03e2320788
commit 4b55628ac8
5 changed files with 102 additions and 31 deletions
+69
View File
@@ -46,6 +46,39 @@ func TestValidateProjectAcceptsInlineTLKSchema(t *testing.T) {
}
}
func TestValidateAndBuildDerivesFeatOutputWhenOmitted(t *testing.T) {
root := testProjectRoot(t)
mkdirAll(t, filepath.Join(root, "topdata", "data", "feat"))
writeFile(t, filepath.Join(root, "topdata", "base_dialog.json"), "{}\n")
writeFile(t, filepath.Join(root, "topdata", "data", "feat", "base.json"), `{
"columns": ["LABEL", "FEAT", "DESCRIPTION"],
"rows": [
{
"id": 0,
"key": "feat:test",
"LABEL": "FEAT_TEST",
"FEAT": {"tlk": {"key": "feat:test.name", "text": "Test Feat"}},
"DESCRIPTION": {"tlk": {"key": "feat:test.description", "text": "Test Description"}}
}
]
}`+"\n")
writeFile(t, filepath.Join(root, "topdata", "data", "feat", "lock.json"), `{"feat:test":0}`+"\n")
proj := testProject(root)
report := ValidateProject(proj)
if report.HasErrors() {
t.Fatalf("expected omitted feat output to validate cleanly, got:\n%s", diagnosticsText(report.Diagnostics))
}
result, err := BuildNativeWithOptions(proj, NativeBuildOptions{BuildWiki: false}, nil)
if err != nil {
t.Fatalf("expected omitted feat output to build: %v", err)
}
if _, err := os.Stat(filepath.Join(result.Output2DADir, "feat.2da")); err != nil {
t.Fatalf("expected derived feat.2da output: %v", err)
}
}
func TestValidateProjectRejectsDuplicateJSONKeys(t *testing.T) {
root := testProjectRoot(t)
mkdirAll(t, filepath.Join(root, "topdata", "data", "repadjust"))
@@ -860,6 +893,42 @@ func TestValidateProjectAcceptsCanonicalMasterfeatsContract(t *testing.T) {
}
}
func TestValidateAndBuildDerivesMasterfeatsOutputWhenOmitted(t *testing.T) {
root := testProjectRoot(t)
mkdirAll(t, filepath.Join(root, "topdata", "data", "masterfeats"))
writeFile(t, filepath.Join(root, "topdata", "base_dialog.json"), "{}\n")
writeFile(t, filepath.Join(root, "topdata", "data", "masterfeats", "base.json"), `{
"columns": ["LABEL", "STRREF", "DESCRIPTION", "ICON"],
"rows": [
{
"id": 0,
"key": "masterfeats:weaponfocus",
"LABEL": "WeaponFocus",
"STRREF": "6490",
"DESCRIPTION": "436",
"ICON": "ife_wepfoc"
}
]
}`+"\n")
writeFile(t, filepath.Join(root, "topdata", "data", "masterfeats", "lock.json"), `{
"masterfeats:weaponfocus": 0
}`+"\n")
proj := testProject(root)
report := ValidateProject(proj)
if report.HasErrors() {
t.Fatalf("expected omitted masterfeats output to validate cleanly, got:\n%s", diagnosticsText(report.Diagnostics))
}
result, err := BuildNativeWithOptions(proj, NativeBuildOptions{BuildWiki: false}, nil)
if err != nil {
t.Fatalf("expected omitted masterfeats output to build: %v", err)
}
if _, err := os.Stat(filepath.Join(result.Output2DADir, "masterfeats.2da")); err != nil {
t.Fatalf("expected derived masterfeats.2da output: %v", err)
}
}
func TestValidateProjectRejectsInvalidMasterfeatsContract(t *testing.T) {
root := testProjectRoot(t)
mkdirAll(t, filepath.Join(root, "topdata", "data", "masterfeats"))