Registry / testing / mocktopus

mocktopus

JSON →
library0.8.0rscratesunverified

A mocking framework for Rust that enables mocking of functions and methods.

# Cargo.toml [dependencies] mocktopus = "0.8.0"
INSTALL
IMPORT
SIG · MOCKTOPUS
M
mocktopus
testingrustv0.8.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Mockable
use mocktopus::mocking::Mockable;

Mock a function using Mocktopus for testing.

use mocktopus::mocking::Mockable; fn add(a: i32, b: i32) -> i32 { a + b } fn main() { let mock = add.mock_safe(|_, _| MockResult::Return(42)); assert_eq!(add(1, 2), 42); }
Debug
Known issues
gotchaMocktopus uses nightly Rust features and may not work on stable.
fix
Switch to nightly Rust with `rustup default nightly`.
affects: >=0.8.0
Upgrade
Version history
0.8.0latest on crates.io
Audit
Dependencies

No dependency data recorded yet.

Agent activity
3 hits · last 30 days
node
2
Amazon
1
Resources
mocktopus — cargo add mocktopus · libregistry