From 655e33768f2d9c2bde0de46e3ef57330e93211e4 Mon Sep 17 00:00:00 2001 From: timofey Date: Sun, 15 Oct 2023 14:16:42 +0000 Subject: [PATCH] future test --- src/func/instances/future.rs | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/src/func/instances/future.rs b/src/func/instances/future.rs index d0e5095..27cc459 100644 --- a/src/func/instances/future.rs +++ b/src/func/instances/future.rs @@ -136,3 +136,35 @@ impl<'a> SharedFunctor<'a> for FutureInstance { Box::pin(sa) } } + +#[cfg(test)] +mod future_tests { + use super::{test_suite, tests, FutureInstance}; + + type T = FutureInstance; + + impl<'a> tests::Eqr<'a> for T { + fn eqr( + name: &'a str, + left: Self::F, + right: Self::F, + ) -> tests::R { + tests::eqr( + name, + futures::executor::block_on(left), + futures::executor::block_on(right), + ) + } + } + + impl<'a> test_suite::FunctorTestSuite<'a> for T { + fn sample Self::F))>(mut f: F) { + f(&|a| Box::pin(futures::future::ready(a))); + } + } + + #[test] + fn monad_follows_laws() { + test_suite::monad_follows_laws::().unwrap(); + } +}