Mockey Features Overview
mainMockey provides a wide range of mocking capabilities for Go:
Function and Method Mocking
- Basic: Supports simple, generic, and variadic functions/methods (both value and pointer receivers). Supports hooks.
- Automatic Cleanup:
PatchConveyandPatchRunautomatically release mocks after each test case. - Special Cases:
GetMethodhandles unexported types, unexported methods, and methods in nested structs. - Advanced:
- Interface mocking (experimental)
- Conditional mocking
- Sequential returns
- Decorator pattern (execute original function while mocking)
- Goroutine filtering (include, exclude, or target specific goroutines)
- Accessing the
Mockerobject for advanced usage (e.g., counting execution frequency)
Variable Mocking
- Supports mocking regular variables.
- Supports mocking function variables.