Roll blockchain tests proc macro into normal macro

This means one less crate in the repo. Had to do a Default on TestClient
to satisfy clippy.
This commit is contained in:
LLFourn
2021-05-16 15:07:55 +10:00
parent aaa9943a5f
commit 465ef6e674
7 changed files with 517 additions and 596 deletions

View File

@@ -45,13 +45,6 @@ use crate::FeeRate;
/// See the [`blockchain::electrum`](crate::blockchain::electrum) module for a usage example.
pub struct ElectrumBlockchain(Client);
#[cfg(test)]
#[cfg(feature = "test-electrum")]
#[bdk_blockchain_tests(crate)]
fn local_electrs() -> ElectrumBlockchain {
ElectrumBlockchain::from(Client::new(&testutils::get_electrum_url()).unwrap())
}
impl std::convert::From<Client> for ElectrumBlockchain {
fn from(client: Client) -> Self {
ElectrumBlockchain(client)
@@ -175,3 +168,11 @@ impl ConfigurableBlockchain for ElectrumBlockchain {
)?))
}
}
#[cfg(all(feature = "test-electrum", test))]
testutils::bdk_blockchain_tests! {
bdk => crate,
fn test_instance() -> ElectrumBlockchain {
ElectrumBlockchain::from(Client::new(&testutils::get_electrum_url()).unwrap())
}
}

View File

@@ -234,8 +234,6 @@ pub extern crate sled;
extern crate testutils;
#[allow(unused_imports)]
#[cfg(test)]
#[macro_use]
extern crate testutils_macros;
#[allow(unused_imports)]
#[cfg(test)]
#[macro_use]