test(ltl): pin exact multi-obligation residual AST

This commit is contained in:
pj committed 2026-06-06 13:02:08 +05:30
1 parent 4566a91ea6
commit d554fe0d90
1 file changed
+9 -3
+9 -3
View File
@@ -248,13 +248,19 @@ func TestResidual_HoldsViolatedPending(t *testing.T) {
t.Errorf("violated residual = %v, want false", got)
}
pendingEval := NewEvaluator(Always(Next(Pure(true))))
// A genuinely multi-obligation residual: both Next inners survive to the
// next step folded under And, in registration order. A residual that
// dropped or transposed an obligation would change this exact AST.
predP := ThunkNamed("p", func() (bool, error) { return true, nil })
predQ := ThunkNamed("q", func() (bool, error) { return true, nil })
pendingEval := NewEvaluator(Always(And(Next(predP), Next(predQ))))
pendingEval.Observe()
body, err := json.Marshal(pendingEval.Residual())
if err != nil {
t.Fatal(err)
}
if !strings.Contains(string(body), `"op":"and"`) && !strings.Contains(string(body), `"op":"true"`) {
t.Errorf("pending residual unexpected: %s", body)
want := `{"op":"and","left":{"op":"predicate","name":"p"},"right":{"op":"predicate","name":"q"}}`
if string(body) != want {
t.Errorf("pending residual:\n got: %s\nwant: %s", body, want)
}
}