composition select_second
This commit is contained in:
parent
7e60ff5624
commit
062c532b91
@ -181,9 +181,9 @@ impl<'a, U: SharedFunctor<'a> + Functor<'a>, V: SharedFunctor<'a>> SharedFunctor
|
|||||||
mod composition_tests {
|
mod composition_tests {
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
use crate::func::instances::{option::OptionInstance, result::ResultInstance};
|
use crate::func::instances::{option::*, result::*, tryfuture::TryFutureInstance};
|
||||||
|
|
||||||
use super::{test_suite, tests, CompositionInstance};
|
use super::*;
|
||||||
|
|
||||||
type T = CompositionInstance<OptionInstance, ResultInstance<i32>>;
|
type T = CompositionInstance<OptionInstance, ResultInstance<i32>>;
|
||||||
|
|
||||||
@ -219,4 +219,17 @@ mod composition_tests {
|
|||||||
fn shared_follows_laws() {
|
fn shared_follows_laws() {
|
||||||
test_suite::shared_follows_laws::<T>().unwrap();
|
test_suite::shared_follows_laws::<T>().unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn select_second() {
|
||||||
|
type T = CompositionInstance<TryFutureInstance<i32>, ResultInstance<i32>>;
|
||||||
|
|
||||||
|
let res = futures::executor::block_on(T::select(
|
||||||
|
Box::pin(futures::future::pending::<Result<Result<i32, i32>, i32>>()),
|
||||||
|
Box::pin(futures::future::ready(Ok(Ok(2)))),
|
||||||
|
))
|
||||||
|
.unwrap()
|
||||||
|
.unwrap();
|
||||||
|
assert!(matches!(res, Selected::B(_, 2)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user