Skip to content

Commit

Permalink
test(vm): add test for Predicate Recursion of Death scenario
Browse files Browse the repository at this point in the history
  • Loading branch information
ccamel committed Sep 23, 2024
1 parent 237ae8f commit 7466eb6
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions interpreter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1219,6 +1219,25 @@ func TestInterpreter_Bombing(t *testing.T) {
})
})

t.Run("💣 backtrack of death", func(t *testing.T) {
nbCalls := 0
t.Run("create vm", func(t *testing.T) {
i := New(nil, nil)
assert.NotNil(t, i)
i.InstallHook(limitHooker(&nbCalls))

t.Run("execute program", func(t *testing.T) {
assert.NoError(t, i.Exec("backtrackOfDeath :- repeat, fail."))

t.Run("💥", func(t *testing.T) {
sol := i.QuerySolutionContext(context.Background(), `backtrackOfDeath.`)

assert.Nil(t, sol.sols)
assert.EqualError(t, sol.Err(), "error(resource_error(calls),\\+ /1)")
})
})
})
})
}

func TestInterpreter_QuerySolution(t *testing.T) {
Expand Down

0 comments on commit 7466eb6

Please sign in to comment.