How eproxus/meck works
Project Type Analysis
This is a specialized testing utility library that provides mocking capabilities for Erlang applications. The project structure indicates a focused, single-purpose library with clear separation of core functionality and tests.
Main Components
a. Core Components:
• Mocking Engine (meck.erl as the main interface)
• Code Generation System (meck_code_gen.erl)
• Expectation Handler (meck_expect.erl)
• History Tracker (meck_history.erl)
• Process Manager (meck_proc.erl)
• Argument Matching System (meck_args_matcher.erl)
• Return Specification Handler (meck_ret_spec.erl)
b. External Interfaces:
• Erlang Module System
• Cover Tool Integration
• Original Module Interface (for passthrough functionality)
┌─ Application Layer ─────────────────┐
• External Erlang Applications │
• ┬───────────────────┘
• ↓
┌─ Public Interface ─────────────────┐
• meck.erl (API Layer) │
• ┬───────────────────┘
• ↓
┌─ Core Services Layer ──────────────┐
• ┌─────────┐ ┌────────┐ ┌────────┐ │
• Code Gen │ │Expect │ │History │ │
• ┘ └────────┘ └────────┘ │
• ┌─────────┐ ┌────────┐ ┌────────┐ │
• Matcher │ │Process │ │RetSpec │ │
• ┘ └────────┘ └────────┘ │
• ┬───────────────────┘
• ↓
┌─ Integration Layer ───────────────┐
• Original Module | Cover Tool │
• ┘
Key Interactions to Highlight
• Mock Creation Flow
• Expectation Setting Flow
• Call Interception Process
• Validation Process
• History Recording
• Passthrough Mechanism
Important Details to Capture
• Process linking behavior (show both linked and unlinked modes)
• Cover data backup/restore mechanism
• Module replacement mechanism
• Argument matching system
• Exception handling paths