2020-01-02 15:13:47 -05:00
|
|
|
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
|
2019-04-23 16:27:44 -04:00
|
|
|
|
2020-01-30 11:28:51 -05:00
|
|
|
#[cfg(test)]
|
2019-03-14 19:17:52 -04:00
|
|
|
pub fn run<F>(future: F)
|
|
|
|
where
|
2020-01-30 11:28:51 -05:00
|
|
|
F: std::future::Future<Output = ()> + Send + 'static,
|
2019-03-14 19:17:52 -04:00
|
|
|
{
|
2020-01-30 11:28:51 -05:00
|
|
|
let mut rt = tokio::runtime::Builder::new()
|
2019-12-30 08:57:17 -05:00
|
|
|
.threaded_scheduler()
|
|
|
|
.enable_all()
|
|
|
|
.thread_name("deno")
|
|
|
|
.build()
|
|
|
|
.expect("Unable to create Tokio runtime");
|
2020-01-01 09:51:27 -05:00
|
|
|
rt.block_on(future);
|
2019-04-14 16:07:24 -04:00
|
|
|
}
|