select_second
This commit is contained in:
parent
23fbe93afe
commit
ee86a0092f
@ -139,11 +139,13 @@ impl<'a> SharedFunctor<'a> for FutureInstance {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod future_tests {
|
mod future_tests {
|
||||||
|
use crate::func::{applicative_select::Selected, tests::Eqr, ApplicativeSelect};
|
||||||
|
|
||||||
use super::{test_suite, tests, FutureInstance};
|
use super::{test_suite, tests, FutureInstance};
|
||||||
|
|
||||||
type T = FutureInstance;
|
type T = FutureInstance;
|
||||||
|
|
||||||
impl<'a> tests::Eqr<'a> for T {
|
impl<'a> Eqr<'a> for T {
|
||||||
fn eqr<A: 'a + Send + PartialEq + std::fmt::Debug>(
|
fn eqr<A: 'a + Send + PartialEq + std::fmt::Debug>(
|
||||||
name: &'a str,
|
name: &'a str,
|
||||||
left: Self::F<A>,
|
left: Self::F<A>,
|
||||||
@ -167,4 +169,15 @@ mod future_tests {
|
|||||||
fn monad_follows_laws() {
|
fn monad_follows_laws() {
|
||||||
test_suite::monad_follows_laws::<T>().unwrap();
|
test_suite::monad_follows_laws::<T>().unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn select_second() {
|
||||||
|
match futures::executor::block_on(T::select(
|
||||||
|
Box::pin(futures::future::pending::<i32>()),
|
||||||
|
Box::pin(futures::future::ready(2)),
|
||||||
|
)) {
|
||||||
|
Selected::A(_, _) => panic!("first future ready"),
|
||||||
|
Selected::B(_, b) => assert_eq!(b, 2),
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user