Tests for weight 0, a never-numeric calc operand, the repeat product along a path, and ErrNoData

This commit is contained in:
2026-09-02 18:22:23 +02:00
parent c5c06375d8
commit 34c933b2b3
5 changed files with 62 additions and 12 deletions
+4 -6
View File
@@ -121,12 +121,10 @@ func TestAlternationPicksOneField(t *testing.T) {
}
}
func TestWeightZeroNeverChosen(t *testing.T) {
f := engine(5)
for i := 0; i < 200; i++ {
if got := mustRender(t, f, `[{"format":"X","weight":0},"Y"]`); got != "Y" {
t.Fatalf("weight-0 variant chosen: %q", got)
}
func TestWeightZeroIsRejected(t *testing.T) {
_, err := compile(parse(t, `[{"format":"X","weight":0},"Y"]`))
if err == nil || !strings.Contains(err.Error(), "weight 0") || !strings.Contains(err.Error(), "remove") {
t.Fatalf("compile(weight 0) = %v, want it rejected naming the fix", err)
}
}