Skip to content

Commit b614237

Browse files
committed
fix(tests)!: remove println! usage from tests
1 parent eaa1917 commit b614237

File tree

2 files changed

+5
-17
lines changed

2 files changed

+5
-17
lines changed

crates/bitcoind_rpc/tests/test_emitter.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ pub fn test_sync_local_chain() -> anyhow::Result<()> {
3636
};
3737

3838
// See if the emitter outputs the right blocks.
39-
println!("first sync:");
39+
4040
while let Some(emission) = emitter.next_block()? {
4141
let height = emission.block_height();
4242
let hash = emission.block_hash();
@@ -76,7 +76,7 @@ pub fn test_sync_local_chain() -> anyhow::Result<()> {
7676
.collect::<Vec<_>>();
7777

7878
// See if the emitter outputs the right blocks.
79-
println!("after reorg:");
79+
8080
let mut exp_height = exp_hashes.len() - reorged_blocks.len();
8181
while let Some(emission) = emitter.next_block()? {
8282
let height = emission.block_height();
@@ -132,7 +132,6 @@ pub fn test_sync_local_chain() -> anyhow::Result<()> {
132132
fn test_into_tx_graph() -> anyhow::Result<()> {
133133
let env = TestEnv::new()?;
134134

135-
println!("getting new addresses!");
136135
let addr_0 = env
137136
.rpc_client()
138137
.get_new_address(None, None)?
@@ -145,11 +144,8 @@ fn test_into_tx_graph() -> anyhow::Result<()> {
145144
.rpc_client()
146145
.get_new_address(None, None)?
147146
.assume_checked();
148-
println!("got new addresses!");
149147

150-
println!("mining block!");
151148
env.mine_blocks(101, None)?;
152-
println!("mined blocks!");
153149

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

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

632626
// the mempool emission (that follows the first block emission after reorg) should only
633627
// include mempool txs introduced at reorg height or greater

crates/chain/tests/test_local_chain.rs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ enum ExpectedResult<'a> {
3434

3535
impl<'a> TestLocalChain<'a> {
3636
fn run(mut self) {
37-
println!("[TestLocalChain] test: {}", self.name);
3837
let got_changeset = match self.chain.apply_update(self.update) {
3938
Ok(changeset) => changeset,
4039
Err(got_err) => {
@@ -255,7 +254,7 @@ fn update_local_chain() {
255254
(4, None)
256255
],
257256
init_changeset: &[
258-
(0, Some(h!("_"))),
257+
(0, Some(h!("_"))),
259258
(1, Some(h!("B'"))),
260259
(2, Some(h!("C'"))),
261260
(3, Some(h!("D"))),
@@ -437,8 +436,6 @@ fn local_chain_disconnect_from() {
437436
];
438437

439438
for (i, t) in test_cases.into_iter().enumerate() {
440-
println!("Case {}: {}", i, t.name);
441-
442439
let mut chain = t.original;
443440
let result = chain.disconnect_from(t.disconnect_from.into());
444441
assert_eq!(
@@ -491,7 +488,6 @@ fn checkpoint_from_block_ids() {
491488
];
492489

493490
for (i, t) in test_cases.into_iter().enumerate() {
494-
println!("running test case {}: '{}'", i, t.name);
495491
let result = CheckPoint::from_block_ids(
496492
t.blocks
497493
.iter()
@@ -583,6 +579,7 @@ fn checkpoint_query() {
583579
fn checkpoint_insert() {
584580
struct TestCase<'a> {
585581
/// The name of the test.
582+
#[allow(dead_code)]
586583
name: &'a str,
587584
/// The original checkpoint chain to call [`CheckPoint::insert`] on.
588585
chain: &'a [(u32, BlockHash)],
@@ -629,9 +626,7 @@ fn checkpoint_insert() {
629626
core::iter::once((0, h!("_"))).map(BlockId::from)
630627
}
631628

632-
for (i, t) in test_cases.into_iter().enumerate() {
633-
println!("Running [{}] '{}'", i, t.name);
634-
629+
for t in test_cases.into_iter() {
635630
let chain = CheckPoint::from_block_ids(
636631
genesis_block().chain(t.chain.iter().copied().map(BlockId::from)),
637632
)
@@ -792,7 +787,6 @@ fn local_chain_apply_header_connected_to() {
792787
];
793788

794789
for (i, t) in test_cases.into_iter().enumerate() {
795-
println!("running test case {}: '{}'", i, t.name);
796790
let mut chain = t.chain;
797791
let result = chain.apply_header_connected_to(&t.header, t.height, t.connected_to);
798792
let exp_result = t

0 commit comments

Comments
 (0)