Fix alignment/ids output
This commit is contained in:
@@ -586,6 +586,57 @@ func TestBuildNativeAppliesWildcardConfiguredValueEncodings(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestBuildNativeEncodesExplicitAlignmentAndIDListsInAnyDataset(t *testing.T) {
|
||||
root := testProjectRoot(t)
|
||||
mkdirAll(t, filepath.Join(root, "topdata", "data", "feat"))
|
||||
mkdirAll(t, filepath.Join(root, "topdata", "data", "futuretable", "modules"))
|
||||
writeFile(t, filepath.Join(root, "topdata", "base_dialog.json"), "{}\n")
|
||||
writeFile(t, filepath.Join(root, "topdata", "data", "feat", "base.json"), `{
|
||||
"output": "feat.2da",
|
||||
"columns": ["LABEL"],
|
||||
"rows": [
|
||||
{"id": 2, "key": "feat:first_future", "LABEL": "FirstFuture"},
|
||||
{"id": 17, "key": "feat:second_future", "LABEL": "SecondFuture"}
|
||||
]
|
||||
}`+"\n")
|
||||
writeFile(t, filepath.Join(root, "topdata", "data", "feat", "lock.json"), `{
|
||||
"feat:first_future": 2,
|
||||
"feat:second_future": 17
|
||||
}`+"\n")
|
||||
writeFile(t, filepath.Join(root, "topdata", "data", "futuretable", "base.json"), `{
|
||||
"output": "futuretable.2da",
|
||||
"columns": ["Label", "AnyAlignmentMask", "AnyIDList"],
|
||||
"rows": [
|
||||
{"id": 0, "key": "futuretable:first", "Label": "First"}
|
||||
]
|
||||
}`+"\n")
|
||||
writeFile(t, filepath.Join(root, "topdata", "data", "futuretable", "lock.json"), `{"futuretable:first":0}`+"\n")
|
||||
writeFile(t, filepath.Join(root, "topdata", "data", "futuretable", "modules", "10_first.json"), `{
|
||||
"overrides": [
|
||||
{
|
||||
"key": "futuretable:first",
|
||||
"AnyAlignmentMask": {"alignments": ["lg", "tn", "ce"]},
|
||||
"AnyIDList": {"ids": ["feat:first_future", {"id": "feat:second_future"}]}
|
||||
}
|
||||
]
|
||||
}`+"\n")
|
||||
|
||||
proj := testProject(root)
|
||||
|
||||
result, err := BuildNativeWithOptions(proj, NativeBuildOptions{BuildWiki: false}, nil)
|
||||
if err != nil {
|
||||
t.Fatalf("BuildNativeWithOptions failed: %v", err)
|
||||
}
|
||||
raw, err := os.ReadFile(filepath.Join(result.Output2DADir, "futuretable.2da"))
|
||||
if err != nil {
|
||||
t.Fatalf("read futuretable.2da: %v", err)
|
||||
}
|
||||
got := string(raw)
|
||||
if !strings.Contains(got, "0\tFirst\t0x111\t0x00020011\n") {
|
||||
t.Fatalf("expected generic explicit list encodings in futuretable.2da, got:\n%s", got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestBuildNativeAppliesConfiguredValueDefaults(t *testing.T) {
|
||||
root := testProjectRoot(t)
|
||||
mkdirAll(t, filepath.Join(root, "topdata", "data", "racialtypes", "core", "modules"))
|
||||
|
||||
Reference in New Issue
Block a user