Skip to content

Commit

Permalink
Fix tests without default features
Browse files Browse the repository at this point in the history
  • Loading branch information
praveenperera committed Oct 17, 2024
1 parent 06159c4 commit d248d90
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ pub mod api;
pub mod r#async;
#[cfg(feature = "blocking")]
pub mod blocking;
#[cfg(feature = "async")]
pub mod sleeper;

pub use api::*;
Expand Down Expand Up @@ -1014,25 +1013,25 @@ mod test {
assert_eq!(tx, tx_async);
}

#[cfg(feature = "tokio")]
#[cfg(all(feature = "async", feature = "tokio"))]
#[test]
fn use_builder_with_tokio_as_normal() {
let builder = Builder::new("https://blockstream.info/testnet/api");
let client = builder.build_async();
assert!(client.is_ok());
}

#[cfg(not(feature = "tokio"))]
#[cfg(all(feature = "async", not(feature = "tokio")))]
struct TestRuntime;

#[cfg(not(feature = "tokio"))]
#[cfg(all(feature = "async", not(feature = "tokio")))]
impl Sleeper for TestRuntime {
async fn sleep(duration: Duration) {
tokio::time::sleep(duration).await;
}
}

#[cfg(not(feature = "tokio"))]
#[cfg(all(feature = "async", not(feature = "tokio")))]
#[test]
fn use_with_custom_runtime() {
let builder =
Expand Down

0 comments on commit d248d90

Please sign in to comment.