mirror of
https://github.com/actix/actix
synced 2024-11-30 17:14:36 +01:00
fix tests (#495)
This commit is contained in:
parent
69be546a0f
commit
25266356d1
@ -53,8 +53,12 @@ impl Handler<TestMessageOne> for TestActorTwo {
|
||||
|
||||
#[test]
|
||||
fn it_all_works() {
|
||||
System::new().block_on(async {
|
||||
let sys = System::new();
|
||||
|
||||
sys.block_on(async {
|
||||
TestActorOne.start();
|
||||
TestActorTwo.start();
|
||||
})
|
||||
});
|
||||
|
||||
sys.run().unwrap();
|
||||
}
|
||||
|
@ -100,11 +100,15 @@ where
|
||||
/// }
|
||||
/// # impl Actor for Actor2 {
|
||||
/// # type Context = Context<Self>;
|
||||
/// #
|
||||
/// # fn started(&mut self, _: &mut Self::Context) {
|
||||
/// # System::current().stop();
|
||||
/// # }
|
||||
/// # }
|
||||
///
|
||||
/// # fn main() {
|
||||
/// # let mut sys = System::new();
|
||||
/// # System::new().block_on(async {
|
||||
/// # let sys = System::new();
|
||||
/// # sys.block_on(async {
|
||||
/// let ctx1 = Context::<Actor1>::new();
|
||||
/// let ctx2 = Context::<Actor2>::new();
|
||||
///
|
||||
@ -114,6 +118,7 @@ where
|
||||
/// ctx1.run(actor1);
|
||||
/// ctx2.run(actor2);
|
||||
/// # });
|
||||
/// # sys.run().unwrap();
|
||||
/// # }
|
||||
/// ```
|
||||
#[inline]
|
||||
|
@ -148,9 +148,13 @@ impl Actor for WeakRecipientRunner {
|
||||
|
||||
#[test]
|
||||
fn test_weak_recipient() {
|
||||
System::new().block_on(async move {
|
||||
let sys = System::new();
|
||||
|
||||
sys.block_on(async move {
|
||||
WeakRecipientRunner.start();
|
||||
});
|
||||
|
||||
sys.run().unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -3,13 +3,6 @@ use std::sync::atomic::{AtomicUsize, Ordering};
|
||||
use std::sync::Arc;
|
||||
use tokio::sync::oneshot;
|
||||
|
||||
#[derive(Debug)]
|
||||
struct Panic();
|
||||
|
||||
impl Message for Panic {
|
||||
type Result = ();
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
struct Ping(usize);
|
||||
|
||||
@ -33,14 +26,6 @@ impl Handler<Ping> for MyActor {
|
||||
}
|
||||
}
|
||||
|
||||
impl Handler<Panic> for MyActor {
|
||||
type Result = ();
|
||||
|
||||
fn handle(&mut self, _: Panic, _: &mut actix::Context<MyActor>) {
|
||||
panic!("Whoops!");
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_start_actor_message() {
|
||||
let count = Arc::new(AtomicUsize::new(0));
|
||||
|
Loading…
Reference in New Issue
Block a user