Skip to content

Commit b2b7c22

Browse files
committed
Merge #259: Annotate null-returning integration test functions with ()
7370bcf Annotate null-returning integration test functions with () (GideonBature) Pull request description: Adds `let _: () = ...` to all integration test cases where client functions return `()`, making it obvious that these functions return no value. Closes #256. ACKs for top commit: tcharding: ACK 7370bcf Tree-SHA512: b0e7009f231e92343c5b90da4cf0eefcf22d1cd7872e35e075c782a53d716e59781b42da1594b9568955c4b412a7d6678af8afc0f23f386f48b1fc6d05972605
2 parents 964cfca + 7370bcf commit b2b7c22

File tree

3 files changed

+16
-16
lines changed

3 files changed

+16
-16
lines changed

integration_test/tests/blockchain.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ fn blockchain__precious_block() {
267267
let hash = node.client.best_block_hash().expect("best_block_hash failed");
268268
node.mine_a_block();
269269

270-
let _ = node.client.precious_block(hash).expect("preciousblock");
270+
let _: () = node.client.precious_block(hash).expect("preciousblock");
271271
}
272272

273273
#[test]
@@ -293,7 +293,7 @@ fn blockchain__savemempool() {
293293

294294
#[cfg(feature = "v22_and_below")]
295295
{
296-
node.client.save_mempool().expect("savemempool");
296+
let _: () = node.client.save_mempool().expect("savemempool");
297297
}
298298

299299
#[cfg(not(feature = "v22_and_below"))]

integration_test/tests/network.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,18 @@ fn network__add_node() {
1919

2020
let dummy_peer = "192.0.2.1:8333";
2121

22-
node.client.add_node(dummy_peer, AddNodeCommand::OneTry).expect("addnode onetry");
23-
node.client.add_node(dummy_peer, AddNodeCommand::Add).expect("addnode add");
24-
node.client.add_node(dummy_peer, AddNodeCommand::Remove).expect("addnode remove");
22+
let _: () = node.client.add_node(dummy_peer, AddNodeCommand::OneTry).expect("addnode onetry");
23+
let _: () = node.client.add_node(dummy_peer, AddNodeCommand::Add).expect("addnode add");
24+
let _: () = node.client.add_node(dummy_peer, AddNodeCommand::Remove).expect("addnode remove");
2525
}
2626

2727
#[test]
2828
fn network__clear_banned() {
2929
let node = Node::with_wallet(Wallet::None, &[]);
3030
let dummy_subnet = "192.0.2.2";
3131

32-
node.client.set_ban(dummy_subnet, SetBanCommand::Add).expect("setban add");
33-
node.client.clear_banned().expect("clearbanned");
32+
let _: () = node.client.set_ban(dummy_subnet, SetBanCommand::Add).expect("setban add");
33+
let _: () = node.client.clear_banned().expect("clearbanned");
3434
}
3535

3636
#[test]
@@ -40,7 +40,7 @@ fn network__disconnect_node() {
4040
let peers = node2.client.get_peer_info().expect("getpeerinfo");
4141
let peer = peers.0.first().expect("should have at least one peer");
4242

43-
node2.client.disconnect_node(&peer.address).expect("disconnectnode");
43+
let _: () = node2.client.disconnect_node(&peer.address).expect("disconnectnode");
4444
}
4545

4646
#[test]
@@ -130,16 +130,16 @@ fn network__list_banned() {
130130
#[test]
131131
fn network__ping() {
132132
let node = Node::with_wallet(Wallet::None, &[]);
133-
node.client.ping().expect("ping");
133+
let _: () = node.client.ping().expect("ping");
134134
}
135135

136136
#[test]
137137
fn network__set_ban() {
138138
let node = Node::with_wallet(Wallet::None, &[]);
139139
let dummy_subnet = "192.0.2.3";
140140

141-
node.client.set_ban(dummy_subnet, SetBanCommand::Add).expect("setban add");
142-
node.client.set_ban(dummy_subnet, SetBanCommand::Remove).expect("setban remove");
141+
let _: () = node.client.set_ban(dummy_subnet, SetBanCommand::Add).expect("setban add");
142+
let _: () = node.client.set_ban(dummy_subnet, SetBanCommand::Remove).expect("setban remove");
143143
}
144144

145145
#[test]

integration_test/tests/wallet.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ fn wallet__abandon_transaction() {
3434

3535
node.client.invalidate_block(block_hash).expect("invalidateblock");
3636

37-
node.client.abandon_transaction(txid).expect("abandontransaction");
37+
let _: () = node.client.abandon_transaction(txid).expect("abandontransaction");
3838
}
3939

4040
#[test]
@@ -69,7 +69,7 @@ fn wallet__backup_wallet() {
6969
let node = Node::with_wallet(Wallet::Default, &[]);
7070
let file_path = integration_test::random_tmp_file();
7171

72-
node.client.backup_wallet(&file_path).expect("backupwallet");
72+
let _: () = node.client.backup_wallet(&file_path).expect("backupwallet");
7373
assert!(file_path.exists(), "Backup file should exist at destination");
7474
assert!(file_path.is_file(), "Backup destination should be a file");
7575

@@ -307,7 +307,7 @@ fn wallet__import_address() {
307307
let pubkey = privkey.public_key(&secp);
308308
let addr = bitcoin::Address::p2pkh(&pubkey, privkey.network);
309309

310-
node.client.import_address(&addr).expect("importaddress");
310+
let _: () = node.client.import_address(&addr).expect("importaddress");
311311
}
312312

313313
#[cfg(not(feature = "v17"))]
@@ -345,7 +345,7 @@ fn wallet__import_privkey() {
345345
let privkey =
346346
PrivateKey::from_wif("cVt4o7BGAig1UXywgGSmARhxMdzP5qvQsxKkSsc1XEkw3tDTQFpy").unwrap();
347347

348-
node.client.import_privkey(&privkey).expect("importprivkey");
348+
let _: () = node.client.import_privkey(&privkey).expect("importprivkey");
349349
}
350350

351351
#[test]
@@ -428,7 +428,7 @@ fn create_load_unload_wallet() {
428428

429429
// Upto version 20 Core returns null for `unloadwallet`.
430430
#[cfg(feature = "v20_and_below")]
431-
let _ = node.client.unload_wallet(&wallet).expect("unloadwallet");
431+
let _: () = node.client.unload_wallet(&wallet).expect("unloadwallet");
432432

433433
// From version 21 Core returns warnings for `unloadwallet`.
434434
#[cfg(not(feature = "v20_and_below"))]

0 commit comments

Comments
 (0)