(define (func arg ...)
(check-foo)
(check-bar)
body ...)
What if it's very important that we call check-foobeforecheck-bar? The mock testing library cannot currently handle this situation well. Using define/mock makes the two procedures independently mocked. Alternatively we could pass in check-foo and check-bar (like the explicit form of define/mock shown in the guide before it's introduced) and pass in the same mock for both arguments, but that's hard to configure in testing and reintroduces the boilerplate that define/mock is supposed to avoid.
We need some way of associating with the func procedure with all mocked dependencies, and getting a list of all calls made by any dependencies of func within a with-mocks form.
Consider this function:
What if it's very important that we call
check-foo
beforecheck-bar
? The mock testing library cannot currently handle this situation well. Usingdefine/mock
makes the two procedures independently mocked. Alternatively we could pass in check-foo and check-bar (like the explicit form ofdefine/mock
shown in the guide before it's introduced) and pass in the same mock for both arguments, but that's hard to configure in testing and reintroduces the boilerplate thatdefine/mock
is supposed to avoid.We need some way of associating with the
func
procedure with all mocked dependencies, and getting a list of all calls made by any dependencies offunc
within awith-mocks
form.