HMock with DefaultSignatures
In the Mocking FileStatus blog entry, I demonstrated a way to mock the unix/unix-compat file status API. My example used the DefaultSignatures extension to provide default implementations of methods for MonadIO monads. I am writing HMock tests today and discovered that makeMockable is incompatible with the DefaultSignatures extension.
I created an issue right before
lunch, and I decided to go ahead and implement a fix after lunch. The
code iterates over the declarations within a class declaration and
throws an error if any are not signatures for methods that can be
mocked. It was easy to fix by filtering the member declarations before
they are processed, which allows declarations of specific types (such as
DefaultSigD
) to be ignored.
The Mocking FileStatus code does not work with the current release of HMock due to this issue, but the issue will (hopefully) soon be fixed with a pull request.