Test that New without WithSeed fails naming it, that the CLI without --seed draws afresh each run, and seed every test's New

This commit is contained in:
2026-10-12 18:10:57 +02:00
committed by Lillem4n
parent 1a5b632b90
commit 3ae8b9f1b1
19 changed files with 91 additions and 87 deletions
+2 -2
View File
@@ -253,7 +253,7 @@ func TestNameErrors(t *testing.T) {
}
files[name] = body
}
_, err := New(WithDataPath(writeFiles(t, files)))
_, err := New(WithSeed(1), WithDataPath(writeFiles(t, files)))
if c.want == "" {
if err != nil {
t.Fatalf("New() = %v, want it to load", err)
@@ -463,7 +463,7 @@ func TestARowThroughANameHintsAPathThatLoads(t *testing.T) {
files := nameTables()
files["card.json"] = `{"format":"{x as r}{r[01]}","x":"{/region}"}`
want := `a path through name "r" may not select a row; bind the row to a name of its own`
if _, err := New(WithDataPath(writeFiles(t, files))); err == nil || !strings.Contains(err.Error(), want) {
if _, err := New(WithSeed(1), WithDataPath(writeFiles(t, files))); err == nil || !strings.Contains(err.Error(), want) {
t.Errorf("New(a field-bound name selecting a row) = %v, want %s", err, want)
}
}