Skip to content

test: make explicit returned stdlib types in tests#604

Open
alexgrad42 wants to merge 1 commit into
rust-bitcoin:masterfrom
alexgrad42:feature/add_explicit_return_type
Open

test: make explicit returned stdlib types in tests#604
alexgrad42 wants to merge 1 commit into
rust-bitcoin:masterfrom
alexgrad42:feature/add_explicit_return_type

Conversation

@alexgrad42
Copy link
Copy Markdown

Fixes #600

No more primitive return types in tests

$  grep -rn 'let _ = .*node\.client' . --exclude-dir=target | awk -F'node.client.' '{print $2}' | awk -F'(' '{print $1}' | sort -u | xargs -I {} grep -rnE 'fn[[:space:]]+{}' .  --exclude-dir=target
./client/src/client_sync/v17/hidden.rs:20:            pub fn estimate_raw_fee(&self, conf_target: u32) -> Result<EstimateRawFee> {
./client/src/client_sync/v17/generating.rs:17:            pub fn generate_to_address(
./client/src/client_sync/v26/mining.rs:17:            pub fn get_prioritised_transactions(&self) -> Result<GetPrioritisedTransactions> {
./client/src/client_sync/v18/control.rs:15:            pub fn get_rpc_info(&self) -> Result<GetRpcInfo> { self.call("getrpcinfo", &[]) }
./client/src/client_sync/v17/wallet.rs:180:            pub fn new_address(&self) -> Result<bitcoin::Address> {
./client/src/client_sync/v17/wallet.rs:187:            pub fn new_address_with_type(&self, ty: AddressType) -> Result<bitcoin::Address> {
./client/src/client_sync/v17/wallet.rs:195:            pub fn new_address_with_label(
./client/src/client_sync/v17/wallet.rs:195:            pub fn new_address_with_label(
./client/src/client_sync/v17/wallet.rs:187:            pub fn new_address_with_type(&self, ty: AddressType) -> Result<bitcoin::Address> {
./client/src/client_sync/v17/raw_transactions.rs:180:            pub fn send_raw_transaction(
./client/src/client_sync/v17/wallet.rs:579:            pub fn send_to_address(
./client/src/client_sync/v17/wallet.rs:589:            pub fn send_to_address_rbf(
$

Copy link
Copy Markdown
Collaborator

@jamillambert jamillambert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One nit, the rest is good.

Comment thread integration_test/tests/control.rs Outdated
fn control__uptime() {
let node = BitcoinD::with_wallet(Wallet::None, &[]);
let _ = node.client.uptime().unwrap();
let _ : u32 = node.client.uptime().unwrap();
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
let _ : u32 = node.client.uptime().unwrap();
let _: u32 = node.client.uptime().unwrap();

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just ran CI and the formatter also picked this up

Copy link
Copy Markdown
Author

@alexgrad42 alexgrad42 May 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed
Checking formatting...
$ cargo fmt -p bitcoind -p corepc-client -p jsonrpc -p bitreq -p corepc-types -p jsonrpc-fuzz --check
Formatting check passed

@alexgrad42 alexgrad42 force-pushed the feature/add_explicit_return_type branch from 61730dc to 60c493d Compare May 22, 2026 15:33
Copy link
Copy Markdown
Collaborator

@jamillambert jamillambert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 60c493d

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add elicit type when testing any method that returns a stdlib type

2 participants