Merge pull request #1196 from nuttycom/fix/zip321_test_deps

zcash_client_backend: Fix incorrect handling of zip321 test dependencies.
This commit is contained in:
Kris Nuttycombe 2024-02-26 08:06:44 -07:00 committed by GitHub
commit de2d4e71af
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 17 deletions

View File

@ -105,6 +105,7 @@ rand_core.workspace = true
shardtree = { workspace = true, features = ["test-dependencies"] } shardtree = { workspace = true, features = ["test-dependencies"] }
zcash_proofs.workspace = true zcash_proofs.workspace = true
zcash_address = { workspace = true, features = ["test-dependencies"] } zcash_address = { workspace = true, features = ["test-dependencies"] }
zcash_keys = { workspace = true, features = ["test-dependencies"] }
time = ">=0.3.22, <0.3.24" # time 0.3.24 has MSRV 1.67 time = ">=0.3.22, <0.3.24" # time 0.3.24 has MSRV 1.67

View File

@ -223,7 +223,7 @@ impl TransactionRequest {
/// A utility for use in tests to help check round-trip serialization properties. /// A utility for use in tests to help check round-trip serialization properties.
/// by comparing a two transaction requests for equality after normalization. /// by comparing a two transaction requests for equality after normalization.
#[cfg(all(test, feature = "test-dependencies"))] #[cfg(test)]
pub(in crate::zip321) fn normalize_and_eq( pub(in crate::zip321) fn normalize_and_eq(
a: &mut TransactionRequest, a: &mut TransactionRequest,
b: &mut TransactionRequest, b: &mut TransactionRequest,
@ -735,7 +735,7 @@ mod parse {
} }
} }
#[cfg(feature = "test-dependencies")] #[cfg(any(test, feature = "test-dependencies"))]
pub mod testing { pub mod testing {
use proptest::collection::btree_map; use proptest::collection::btree_map;
use proptest::collection::vec; use proptest::collection::vec;
@ -825,12 +825,16 @@ pub mod testing {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use proptest::prelude::{any, proptest};
use std::str::FromStr; use std::str::FromStr;
use zcash_keys::address::testing::arb_addr; use zcash_keys::address::testing::arb_addr;
use zcash_primitives::{ use zcash_primitives::{
consensus::{Parameters, TEST_NETWORK}, consensus::{Parameters, TEST_NETWORK},
memo::Memo, memo::Memo,
transaction::components::amount::{Amount, NonNegativeAmount}, transaction::components::amount::{
testing::arb_nonnegative_amount, Amount, NonNegativeAmount,
},
}; };
#[cfg(feature = "local-consensus")] #[cfg(feature = "local-consensus")]
@ -841,20 +845,9 @@ mod tests {
use super::{ use super::{
memo_from_base64, memo_to_base64, memo_from_base64, memo_to_base64,
parse::{parse_amount, zcashparam, Param}, parse::{parse_amount, zcashparam, Param},
render::amount_str, render::{amount_str, memo_param, str_param},
MemoBytes, Payment, TransactionRequest,
};
#[cfg(all(test, feature = "test-dependencies"))]
use proptest::prelude::{any, proptest};
#[cfg(all(test, feature = "test-dependencies"))]
use zcash_primitives::transaction::components::amount::testing::arb_nonnegative_amount;
#[cfg(all(test, feature = "test-dependencies"))]
use super::{
render::{memo_param, str_param},
testing::{arb_addr_str, arb_valid_memo, arb_zip321_request, arb_zip321_uri}, testing::{arb_addr_str, arb_valid_memo, arb_zip321_request, arb_zip321_uri},
MemoBytes, Payment, TransactionRequest,
}; };
fn check_roundtrip(req: TransactionRequest) { fn check_roundtrip(req: TransactionRequest) {
@ -1099,7 +1092,6 @@ mod tests {
assert!(i10r.is_err()); assert!(i10r.is_err());
} }
#[cfg(all(test, feature = "test-dependencies"))]
proptest! { proptest! {
#[test] #[test]
fn prop_zip321_roundtrip_address(addr in arb_addr(UA_REQUEST)) { fn prop_zip321_roundtrip_address(addr in arb_addr(UA_REQUEST)) {