diff options
Diffstat (limited to 'tests-integration/tests/rt_shell.rs')
-rw-r--r-- | tests-integration/tests/rt_shell.rs | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/tests-integration/tests/rt_shell.rs b/tests-integration/tests/rt_shell.rs new file mode 100644 index 00000000..392c0519 --- /dev/null +++ b/tests-integration/tests/rt_shell.rs @@ -0,0 +1,32 @@ +#![warn(rust_2018_idioms)] +#![cfg(feature = "sync")] + +use tokio::runtime; +use tokio::sync::oneshot; + +use std::sync::mpsc; +use std::thread; + +#[test] +fn basic_shell_rt() { + let (feed_tx, feed_rx) = mpsc::channel::<oneshot::Sender<()>>(); + + let th = thread::spawn(move || { + for tx in feed_rx.iter() { + tx.send(()).unwrap(); + } + }); + + for _ in 0..1_000 { + let mut rt = runtime::Builder::new().build().unwrap(); + + let (tx, rx) = oneshot::channel(); + + feed_tx.send(tx).unwrap(); + + rt.block_on(rx).unwrap(); + } + + drop(feed_tx); + th.join().unwrap(); +} |