mirror of
https://gitlab.com/fabinfra/fabaccess/bffh.git
synced 2024-11-24 15:47:57 +01:00
37 lines
749 B
Rust
37 lines
749 B
Rust
use executor::prelude::{spawn, ProcStack};
|
|
use executor::run::run;
|
|
use std::io::Write;
|
|
use std::thread;
|
|
use std::time::Duration;
|
|
|
|
#[cfg(feature = "tokio-runtime")]
|
|
mod tokio_tests {
|
|
#[tokio::test]
|
|
async fn test_run_blocking() {
|
|
super::run_test()
|
|
}
|
|
}
|
|
|
|
#[cfg(not(feature = "tokio-runtime"))]
|
|
mod no_tokio_tests {
|
|
#[test]
|
|
fn test_run_blocking() {
|
|
super::run_test()
|
|
}
|
|
}
|
|
|
|
fn run_test() {
|
|
let handle = spawn(async {
|
|
let duration = Duration::from_millis(1);
|
|
thread::sleep(duration);
|
|
//42
|
|
});
|
|
|
|
let output = run(handle, ProcStack {});
|
|
|
|
println!("{:?}", output);
|
|
std::io::stdout().flush();
|
|
assert!(output.is_some());
|
|
std::thread::sleep(Duration::from_millis(200));
|
|
}
|