test for StartActor message
+extern crate futures;
#[macro_use]extern crate actix;
use std::sync::Arc;
use std::sync::atomic::{AtomicUsize, Ordering};
+use futures::Future;
use actix::prelude::*;
#[derive(Debug, Message)]
@@ -36,3 +38,25 @@ fn test_start_actor() {
sys.run();
assert_eq!(count.load(Ordering::Relaxed), 1);
}
+
+
+#[test]
+fn test_start_actor_message() {
+ let sys = System::new("test");
+ let count = Arc::new(AtomicUsize::new(0));
+
+ let act_count = Arc::clone(&count);
+ let arbiter = Arbiter::new("test2");
+
+ Arbiter::handle().spawn(
+ arbiter.call_fut(
+ actix::msgs::StartActor::new(move |_| {
+ MyActor(act_count)
+ })).then(|res| {
+ res.unwrap().unwrap().send(Ping(1));
+ Ok(())
+ }));
+
+ sys.run();
+ assert_eq!(count.load(Ordering::Relaxed), 1);
+}
