jackfirth / racket-mock

Mocking library for Racket
Other
22 stars 7 forks source link

Cross-mock in-order checking. #95

Closed jackfirth closed 7 years ago

jackfirth commented 8 years ago

Consider this function:

(define (func arg ...)
  (check-foo)
  (check-bar)
  body ...)

What if it's very important that we call check-foo before check-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.