Replace futures::executor::block_on with tokio::block_in_place
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
use scryer_prolog::MachineBuilder;
|
||||
|
||||
pub(crate) trait Expectable {
|
||||
#[track_caller]
|
||||
fn assert_eq(self, other: &[u8]);
|
||||
@@ -31,3 +33,17 @@ pub(crate) fn load_module_test<T: Expectable>(file: &str, expected: T) {
|
||||
let mut wam = MachineBuilder::default().build();
|
||||
expected.assert_eq(wam.test_load_file(file).as_slice());
|
||||
}
|
||||
|
||||
/// Same as `load_module_test` with tokio runtime
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
pub(crate) fn load_module_test_with_tokio_runtime<T: Expectable>(file: &str, expected: T) {
|
||||
let runtime = tokio::runtime::Builder::new_multi_thread()
|
||||
.enable_all()
|
||||
.build()
|
||||
.unwrap();
|
||||
|
||||
runtime.block_on(async move {
|
||||
let mut wam = MachineBuilder::default().build();
|
||||
expected.assert_eq(wam.test_load_file(file).as_slice())
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user