()
| 134 | |
| 135 | #[tokio::test] |
| 136 | async fn test_runtime_spawn() { |
| 137 | let runtime = Runtime::new(); |
| 138 | runtime.start(); |
| 139 | |
| 140 | let agent = runtime |
| 141 | .spawn(|mailbox: Mailbox<i32>| async move { |
| 142 | while let Ok(_msg) = mailbox.recv().await { |
| 143 | // Process message |
| 144 | } |
| 145 | }) |
| 146 | .await; |
| 147 | |
| 148 | assert!(agent.id > 0); |
| 149 | |
| 150 | let metrics = runtime.metrics().await; |
| 151 | assert_eq!(metrics.agents_spawned, 1); |
| 152 | |
| 153 | runtime.stop().await; |
| 154 | } |
| 155 | } |