Expand description
Mock Command Executor for Testing Quality Gates
This module provides infrastructure for mocking external command execution to enable unit testing of quality gate logic without running actual commands.
§Design
Uses trait-based dependency injection to allow:
- Real execution in production (
RealCommandExecutor) - Mock execution in tests (
MockCommandExecutor)
§Example
ⓘ
let mut mock = MockCommandExecutor::new();
mock.register("cargo", &["clippy"], CommandResult::success("Clippy passed"));
let result = mock.execute("cargo", &["clippy"]);
assert!(result.success);Structs§
- Command
Key - Key for identifying a command (program + args combination)
- Command
Result - Result of command execution
- Mock
Command Executor - Mock command executor for testing
- Real
Command Executor - Real command executor using std::process::Command
Traits§
- Command
Executor - Trait for executing external commands