Automock - crate for mocking anything
The Rust Programming Language Forum
Automock - crate for mocking anything
Hi! I'd like to share a project I've been working on in my free time for the past year. It's a crate for mocking functions, traits and structs. https://crates.io/crates/automock #[automock::mock] trait Trait { fn work(&self, v: i32) -> i32; } #[test] fn test() { // Arrange let mut mock = TraitMock::new(); mock.setup().work(1).returns_once(2); // Act let result = mock.work(1); // Assert assert_eq!(result, 2); mock.verify_calls(); } It already cov...
0 comments
No comments yet.