diff --git a/src/func/instances/composition.rs b/src/func/instances/composition.rs index 81d960e..2229fe2 100644 --- a/src/func/instances/composition.rs +++ b/src/func/instances/composition.rs @@ -210,6 +210,15 @@ mod composition_tests { } } + impl<'a> test_suite::FailTestSuite<'a, i32> for T { + fn sample_fail i32>)>(mut f: F) { + f(Arc::new(|| 0)); + f(Arc::new(|| 1)); + f(Arc::new(|| 2)); + f(Arc::new(|| 3)); + } + } + #[test] fn monad_follows_laws() { test_suite::monad_follows_laws::().unwrap(); @@ -220,6 +229,11 @@ mod composition_tests { test_suite::shared_follows_laws::().unwrap(); } + #[test] + fn fail_follows_laws() { + test_suite::fail_functor_follows_laws::().unwrap(); + } + #[test] fn select_second() { type T = CompositionInstance, ResultInstance>; diff --git a/src/func/instances/result.rs b/src/func/instances/result.rs index f2515bb..acb0428 100644 --- a/src/func/instances/result.rs +++ b/src/func/instances/result.rs @@ -276,6 +276,15 @@ mod result_tests { } } + impl<'a> test_suite::FailTestSuite<'a, i32> for T { + fn sample_fail i32>)>(mut f: F) { + f(Arc::new(|| 0)); + f(Arc::new(|| 1)); + f(Arc::new(|| 2)); + f(Arc::new(|| 3)); + } + } + #[test] fn monad_follows_laws() { test_suite::monad_follows_laws::().unwrap(); @@ -285,4 +294,9 @@ mod result_tests { fn shared_follows_laws() { test_suite::shared_follows_laws::().unwrap(); } + + #[test] + fn fail_follows_laws() { + test_suite::fail_functor_follows_laws::().unwrap(); + } } diff --git a/src/func/instances/tryfuture.rs b/src/func/instances/tryfuture.rs index 77f2e6c..f26f32f 100644 --- a/src/func/instances/tryfuture.rs +++ b/src/func/instances/tryfuture.rs @@ -239,6 +239,15 @@ mod tryfuture_tests { } } + impl<'a> test_suite::FailTestSuite<'a, i32> for T { + fn sample_fail i32>)>(mut f: F) { + f(Arc::new(|| 0)); + f(Arc::new(|| 1)); + f(Arc::new(|| 2)); + f(Arc::new(|| 3)); + } + } + #[test] fn monad_follows_laws() { test_suite::monad_follows_laws::().unwrap(); @@ -258,4 +267,9 @@ mod tryfuture_tests { fn shared_follows_laws() { test_suite::shared_follows_laws::().unwrap(); } + + #[test] + fn fail_follows_laws() { + test_suite::fail_functor_follows_laws::().unwrap(); + } }