test(ltl): migrate thunk call sites to (bool,error)

This commit is contained in:
pj committed 2026-06-01 13:53:42 +05:30
1 parent 9be00dff90
commit a01e126ff9
4 files changed
+25 -25

No files matched your search

+5 -5
View File
@@ -36,10 +36,10 @@ func TestPure_FalseImmediatelyViolates(t *testing.T) {
func TestThunk_TransitionFromHoldToViolate(t *testing.T) {
values := []bool{true, true, false, true, true}
step := 0
evaluator := NewEvaluator(Always(Thunk(func() bool {
evaluator := NewEvaluator(Always(Thunk(func() (bool, error) {
current := values[step]
step++
return current
return current, nil
})))
wantSequence := []Verdict{
@@ -59,7 +59,7 @@ func TestThunk_TransitionFromHoldToViolate(t *testing.T) {
func TestEvaluator_StickinessAfterViolation(t *testing.T) {
state := true
evaluator := NewEvaluator(Always(Thunk(func() bool { return state })))
evaluator := NewEvaluator(Always(Thunk(func() (bool, error) { return state, nil })))
if got := evaluator.Observe(); got != VerdictHolds {
t.Fatalf("step 1: got %v, want holds", got)
@@ -83,7 +83,7 @@ func TestEvaluator_TopLevelPureCountedAtEachStep(t *testing.T) {
func TestEvaluator_TopLevelThunkRespectsObservation(t *testing.T) {
state := true
evaluator := NewEvaluator(Thunk(func() bool { return state }))
evaluator := NewEvaluator(Thunk(func() (bool, error) { return state, nil }))
if got := evaluator.Observe(); got != VerdictHolds {
t.Errorf("expected holds, got %v", got)
}
@@ -107,7 +107,7 @@ func TestDescribe(t *testing.T) {
if got := Describe(formula); !strings.Contains(got, "Always") || !strings.Contains(got, "Pure(true)") {
t.Errorf("Describe wrong: %q", got)
}
thunk := Always(Thunk(func() bool { return true }))
thunk := Always(Thunk(func() (bool, error) { return true, nil }))
if got := Describe(thunk); !strings.Contains(got, "Thunk") {
t.Errorf("Describe(thunk) wrong: %q", got)
}