mocktopus

Crates.iomocktopus
lib.rsmocktopus
version0.8.0
sourcesrc
created_at2017-09-05 18:26:26.018161
updated_at2022-12-16 14:31:52.118777
descriptionMocking framework for Rust
homepage
repositoryhttps://github.com/CodeSandwich/Mocktopus
max_upload_size
id30677
size229,948
Greg Hill (gregdhill)

documentation

README

logo

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());
}
Commit count: 208

cargo fmt