Skip to content

Commit

Permalink
Add a use of mock! in mockall_examples
Browse files Browse the repository at this point in the history
  • Loading branch information
asomers committed Mar 13, 2020
1 parent 870eca7 commit aeddf90
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion mockall_examples/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// vim: tw=80
//#![deny(missing_docs)]
#![deny(missing_docs)]

//! Examples of mock objects and their generated methods.
//!
Expand Down Expand Up @@ -33,6 +33,28 @@ pub trait Foo {
fn bang(x: i32) -> i32;
}

/// A trait implemented by a Struct we want to mock
pub trait Bah {
/// Some trait method
fn bah(&self);
}

#[cfg(doc)]
mock! {
/// structs can be mocked with `mock!`
///
/// Their mock methods have an identical API to the methods generated by
/// `#[automock]`
pub Boo {
/// A method on a struct
fn boo(&self);
}
/// An implementation of a trait on a mocked struct
trait Bah {
fn bah(&self);
}
}

#[cfg(doc)]
#[automock(mod mock_ffi;)]
extern "C" {
Expand Down

0 comments on commit aeddf90

Please sign in to comment.