Skip to content

Commit

Permalink
test: update with new panic error
Browse files Browse the repository at this point in the history
  • Loading branch information
bdeneux committed Jul 24, 2024
1 parent 115d4be commit 7d0eab8
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions engine/builtin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ func TestCall(t *testing.T) {
panic("told you")
})
})
vm.Register0(NewAtom("do_not_call_wrapped"), func(*VM, Cont, *Env) *Promise {
panic(errors.New("told you"))
})
assert.NoError(t, vm.Compile(context.Background(), `
foo.
foo(_, _).
Expand Down Expand Up @@ -60,8 +63,9 @@ f(g([a, [b, c|X]])).

{title: `cover all`, goal: atomComma.Apply(atomCut, NewAtom("f").Apply(NewAtom("g").Apply(List(NewAtom("a"), PartialList(NewVariable(), NewAtom("b"), NewAtom("c")))))), ok: true},
{title: `out of memory`, goal: NewAtom("foo").Apply(NewVariable(), NewVariable(), NewVariable(), NewVariable(), NewVariable(), NewVariable(), NewVariable(), NewVariable(), NewVariable()), err: resourceError(resourceMemory, nil), mem: 1},
{title: `panic`, goal: NewAtom("do_not_call"), err: errors.New("panic: told you")},
{title: `panic (lazy)`, goal: NewAtom("lazy_do_not_call"), err: errors.New("panic: told you")},
{title: `panic`, goal: NewAtom("do_not_call"), err: PanicError{errors.New("told you")}},
{title: `panic (lazy)`, goal: NewAtom("lazy_do_not_call"), err: PanicError{errors.New("told you")}},
{title: `panic (wrapped)`, goal: NewAtom("do_not_call_wrapped"), err: PanicError{errors.New("told you")}},
}

for _, tt := range tests {
Expand Down

0 comments on commit 7d0eab8

Please sign in to comment.