Skip to content

Commit

Permalink
chore(tests): remove println! usage from tests
Browse files Browse the repository at this point in the history
  • Loading branch information
oleonardolima committed Aug 14, 2024
1 parent 4cd21c1 commit 4ba2a4c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 16 deletions.
15 changes: 7 additions & 8 deletions crates/bitcoind_rpc/tests/test_emitter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ pub fn test_sync_local_chain() -> anyhow::Result<()> {
};

// See if the emitter outputs the right blocks.
println!("first sync:");

while let Some(emission) = emitter.next_block()? {
let height = emission.block_height();
let hash = emission.block_hash();
Expand Down Expand Up @@ -76,7 +76,7 @@ pub fn test_sync_local_chain() -> anyhow::Result<()> {
.collect::<Vec<_>>();

// See if the emitter outputs the right blocks.
println!("after reorg:");

let mut exp_height = exp_hashes.len() - reorged_blocks.len();
while let Some(emission) = emitter.next_block()? {
let height = emission.block_height();
Expand Down Expand Up @@ -132,7 +132,7 @@ pub fn test_sync_local_chain() -> anyhow::Result<()> {
fn test_into_tx_graph() -> anyhow::Result<()> {
let env = TestEnv::new()?;

println!("getting new addresses!");

let addr_0 = env
.rpc_client()
.get_new_address(None, None)?
Expand All @@ -145,11 +145,11 @@ fn test_into_tx_graph() -> anyhow::Result<()> {
.rpc_client()
.get_new_address(None, None)?
.assume_checked();
println!("got new addresses!");

println!("mining block!");


env.mine_blocks(101, None)?;
println!("mined blocks!");


let (mut chain, _) = LocalChain::from_genesis_hash(env.rpc_client().get_block_hash(0)?);
let mut indexed_tx_graph = IndexedTxGraph::<BlockId, _>::new({
Expand Down Expand Up @@ -609,7 +609,7 @@ fn mempool_during_reorg() -> anyhow::Result<()> {
// perform reorgs at different heights, these reorgs will not confirm transactions in the
// mempool
for reorg_count in 1..TIP_DIFF {
println!("REORG COUNT: {}", reorg_count);

env.reorg_empty_blocks(reorg_count)?;

// This is a map of mempool txids to tip height where the tx was introduced to the mempool
Expand All @@ -627,7 +627,6 @@ fn mempool_during_reorg() -> anyhow::Result<()> {
// `next_header` emits the replacement block of the reorg
if let Some(emission) = emitter.next_header()? {
let height = emission.block_height();
println!("\t- replacement height: {}", height);

// the mempool emission (that follows the first block emission after reorg) should only
// include mempool txs introduced at reorg height or greater
Expand Down
8 changes: 1 addition & 7 deletions crates/chain/tests/test_local_chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ fn update_local_chain() {
(4, None)
],
init_changeset: &[
(0, Some(h!("_"))),
(0, Some(h!("_"))),
(1, Some(h!("B'"))),
(2, Some(h!("C'"))),
(3, Some(h!("D"))),
Expand Down Expand Up @@ -436,8 +436,6 @@ fn local_chain_disconnect_from() {
];

for (i, t) in test_cases.into_iter().enumerate() {
println!("Case {}: {}", i, t.name);

let mut chain = t.original;
let result = chain.disconnect_from(t.disconnect_from.into());
assert_eq!(
Expand Down Expand Up @@ -490,7 +488,6 @@ fn checkpoint_from_block_ids() {
];

for (i, t) in test_cases.into_iter().enumerate() {
println!("running test case {}: '{}'", i, t.name);
let result = CheckPoint::from_block_ids(
t.blocks
.iter()
Expand Down Expand Up @@ -629,8 +626,6 @@ fn checkpoint_insert() {
}

for (i, t) in test_cases.into_iter().enumerate() {
println!("Running [{}] '{}'", i, t.name);

let chain = CheckPoint::from_block_ids(
genesis_block().chain(t.chain.iter().copied().map(BlockId::from)),
)
Expand Down Expand Up @@ -791,7 +786,6 @@ fn local_chain_apply_header_connected_to() {
];

for (i, t) in test_cases.into_iter().enumerate() {
println!("running test case {}: '{}'", i, t.name);
let mut chain = t.chain;
let result = chain.apply_header_connected_to(&t.header, t.height, t.connected_to);
let exp_result = t
Expand Down
1 change: 0 additions & 1 deletion crates/wallet/examples/mnemonic_to_descriptors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ use std::str::FromStr;

/// This example demonstrates how to generate a mnemonic phrase
/// using BDK and use that to generate a descriptor string.
fn main() -> Result<(), anyhow::Error> {
let secp = Secp256k1::new();

Expand Down

0 comments on commit 4ba2a4c

Please sign in to comment.