Remove duplicated `#[cfg(test)]` conditions
Several macros used in tests had `#[cfg(test)]` condition on each of them. This deduplicates them by putting them into a separate module and reexporting (with one condition for module and one for re-export).
This commit is contained in:
parent
5548696521
commit
4dedf7d555
|
@ -119,19 +119,19 @@ macro_rules! debug_from_display {
|
||||||
pub(crate) use debug_from_display;
|
pub(crate) use debug_from_display;
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
macro_rules! hex_script (($s:expr) => (<$crate::Script as core::str::FromStr>::from_str($s).unwrap()));
|
pub(crate) use test_macros::*;
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
mod test_macros {
|
||||||
|
macro_rules! hex_script (($s:expr) => (<$crate::Script as core::str::FromStr>::from_str($s).unwrap()));
|
||||||
pub(crate) use hex_script;
|
pub(crate) use hex_script;
|
||||||
|
|
||||||
#[cfg(test)]
|
|
||||||
macro_rules! hex_hash (($h:ident, $s:expr) => ($h::from_slice(&<$crate::prelude::Vec<u8> as $crate::hashes::hex::FromHex>::from_hex($s).unwrap()).unwrap()));
|
macro_rules! hex_hash (($h:ident, $s:expr) => ($h::from_slice(&<$crate::prelude::Vec<u8> as $crate::hashes::hex::FromHex>::from_hex($s).unwrap()).unwrap()));
|
||||||
#[cfg(test)]
|
|
||||||
pub(crate) use hex_hash;
|
pub(crate) use hex_hash;
|
||||||
|
|
||||||
#[cfg(test)]
|
|
||||||
macro_rules! hex_decode (($h:ident, $s:expr) => (deserialize::<$h>(&<$crate::prelude::Vec<u8> as $crate::hashes::hex::FromHex>::from_hex($s).unwrap()).unwrap()));
|
macro_rules! hex_decode (($h:ident, $s:expr) => (deserialize::<$h>(&<$crate::prelude::Vec<u8> as $crate::hashes::hex::FromHex>::from_hex($s).unwrap()).unwrap()));
|
||||||
#[cfg(test)]
|
|
||||||
pub(crate) use hex_decode;
|
pub(crate) use hex_decode;
|
||||||
|
}
|
||||||
|
|
||||||
macro_rules! serde_string_impl {
|
macro_rules! serde_string_impl {
|
||||||
($name:ident, $expecting:literal) => {
|
($name:ident, $expecting:literal) => {
|
||||||
|
|
Loading…
Reference in New Issue