Skip to content

Commit

Permalink
Merge pull request #526 from asomers/rpitit
Browse files Browse the repository at this point in the history
Add a test for the Return Position Impl Trait in Trait feature
  • Loading branch information
asomers authored Dec 9, 2023
2 parents 3d5c289 + 5e8bf3c commit d4102cd
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions mockall/tests/automock_rpitit.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// vim: tw=80
//! Return position Impl Trait in Traits
//! https://rust-lang.github.io/rfcs/3425-return-position-impl-trait-in-traits.html
#![cfg(feature = "nightly")]
#![deny(warnings)]

use std::fmt::Debug;

use mockall::*;

#[automock]
trait Foo {
fn bar(&self) -> impl Debug;
}

#[test]
fn returning() {
let mut foo = MockFoo::default();
foo.expect_bar()
.returning(|| Box::new(42u32));
assert_eq!("42", format!("{:?}", foo.bar()));
}

0 comments on commit d4102cd

Please sign in to comment.