Crates.io | mocktopus |
lib.rs | mocktopus |
version | 0.8.0 |
source | src |
created_at | 2017-09-05 18:26:26.018161 |
updated_at | 2022-12-16 14:31:52.118777 |
description | Mocking framework for Rust |
homepage | |
repository | https://github.com/CodeSandwich/Mocktopus |
max_upload_size | |
id | 30677 |
size | 229,948 |
Mocking framework for Rust (currently only nightly). See documentation for more.
#[mockable]
mod hello_world {
pub fn world() -> &'static str {
"world"
}
pub fn hello_world() -> String {
format!("Hello {}!", world())
}
}
#[test]
fn mock_test() {
hello_world::world.mock_safe(|| MockResult::Return("mocking"));
assert_eq!("Hello mocking!", hello_world::hello_world());
}