-
I have a trait that requires Clone, but I'm having trouble getting it working. I'm not sure what I'm missing, but this is a reduced example I came up with: pub struct Thing;
pub trait Db: Clone {
fn get_things(&self) -> Thing;
}
#[cfg(test)]
mod tests {
use super::*;
use mockall::mock;
#[derive(Clone)]
struct MyDb;
mock! {
MyDb {}
impl Clone for MyDb {
fn clone(&self) -> Self;
}
impl Db for MyDb {
fn get_things(&self) -> Thing;
}
}
#[test]
fn clone_test() {
let db = MockMyDb::new();
db.clone();
}
} With that code when I run
I apologize if I missed something in the documentation or didn't find a relevant discussion, but I haven't been able to find anything in my searches and reading. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
You did everything correctly, but never wrote any expectations. BTW, you might want to look at https://github.com/asomers/mockall/blob/master/mockall/tests/mock_clone.rs . |
Beta Was this translation helpful? Give feedback.
You did everything correctly, but never wrote any expectations. BTW, you might want to look at https://github.com/asomers/mockall/blob/master/mockall/tests/mock_clone.rs .