forked from octaltree/playwright-rust
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathlib.rs
41 lines (36 loc) · 1.01 KB
/
lib.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#[macro_use]
extern crate serde;
#[macro_use]
extern crate serde_with;
pub mod api;
mod imp;
pub use crate::imp::core::{Driver, Error};
pub use api::playwright::Playwright;
#[doc(hidden)]
#[macro_export]
macro_rules! runtime_test {
($name:tt, $main:stmt) => {
#[cfg(feature = "rt-tokio")]
#[test]
fn $name() {
env_logger::builder().is_test(true).try_init().ok();
tokio::runtime::Builder::new_current_thread()
.enable_all()
.build()
.unwrap()
.block_on(async { $main });
}
#[cfg(feature = "rt-actix")]
#[test]
fn $name() {
env_logger::builder().is_test(true).try_init().ok();
actix_rt::System::new().block_on(async { $main });
}
#[cfg(feature = "rt-async-std")]
#[test]
fn $name() {
env_logger::builder().is_test(true).try_init().ok();
async_std::task::block_on(async { $main });
}
};
}