1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
use crate::core::Should; pub use shoulda_core as core; pub use shoulda_core::Shoulda; pub use shoulda_macro::expr as expr_internal; pub use shoulda_macro::Shoulda; #[macro_export] macro_rules! expr { ($x:expr) => { ::shoulda::expr_internal!($x) }; } #[macro_export] macro_rules! expect { ($x:tt) => { ::shoulda::Expect::new(&$x) }; } pub struct Expect<'a, T: Shoulda> { inner: &'a T, } impl<'a, T: Shoulda> Expect<'a, T> { pub fn new(inner: &'a T) -> Self { Self { inner } } pub fn to(self) -> Should<'a, T> { self.inner.should() } }