-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Description
Given the following trait:
pub trait Chal {
fn set_mech_brakes(&self, amt: BrakeAmt) -> &Self;
fn mech_brakes(&self) -> BrakeAmt;
}I have tried:
mock_trait!(ChalMock,
set_brakes(BrakeAmt) -> &Self,
brakes() -> BrakeAmt);
impl Chal for ChalMock {
mock_method!(set_mech_brakes(&self, amt: BrakeAmt) -> &Self);
mock_method!(mech_brakes(&self) -> BrakeAmt);
}but this yields:
error[E0411]: cannot find type `Self` in this scope
--> shal_proto/src/unit_tests.rs:7:38
|
7 | set_brakes(BrakeAmt) -> &Self,
| ^^^^ `Self` is only available in traits and impls
error[E0106]: missing lifetime specifier
--> shal_proto/src/unit_tests.rs:7:37
|
7 | set_brakes(BrakeAmt) -> &Self,
| ^ expected lifetime parameter
error: aborting due to 2 previous errorsI tried:
mock_trait!(ChalMock,
set_brakes(BrakeAmt) -> &ChalMock,
brakes() -> BrakeAmt);
impl Chal for ChalMock {
mock_method!(set_mech_brakes(&self, amt: BrakeAmt) -> &ChalMock);
mock_method!(mech_brakes(&self) -> BrakeAmt);
}which helps, but I am still left with:
error[E0106]: missing lifetime specifier
--> shal_proto/src/unit_tests.rs:7:37
|
7 | set_brakes(BrakeAmt) -> &ChalMock,
| ^ expected lifetime parameter
error: aborting due to previous errorHow can I make a mock of Chal using double?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels