Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/CodeSandwich/Mocktopus
Mocking framework for Rust
https://github.com/CodeSandwich/Mocktopus
mock mocking mocktopus rust rust-library test testing testing-tools unit-testing
Last synced: about 2 months ago
JSON representation
Mocking framework for Rust
- Host: GitHub
- URL: https://github.com/CodeSandwich/Mocktopus
- Owner: CodeSandwich
- License: mit
- Created: 2017-05-31T21:34:22.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2024-04-17T10:04:04.000Z (9 months ago)
- Last Synced: 2024-11-17T10:56:48.963Z (2 months ago)
- Topics: mock, mocking, mocktopus, rust, rust-library, test, testing, testing-tools, unit-testing
- Language: Rust
- Homepage:
- Size: 421 KB
- Stars: 233
- Watchers: 9
- Forks: 20
- Open Issues: 17
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
[![Crates.io](https://img.shields.io/crates/d/mocktopus.svg)](https://crates.io/crates/mocktopus)
[![Docs.rs](https://docs.rs/mocktopus/badge.svg)](https://docs.rs/crate/mocktopus)
[![Build Status](https://travis-ci.org/CodeSandwich/Mocktopus.svg?branch=master)](https://travis-ci.org/CodeSandwich/Mocktopus)
Mocking framework for Rust (currently only nightly). See [documentation](https://docs.rs/mocktopus/) for more.
```rust
#[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());
}
```