Make test panic instead of using code comment
Currently we have a code comment that is supposed to assist devs in maintaining the `network::constants::Network` type by failing to build if a new variant is added. This plays havoc with the formatter because the comment is hanging at the bottom of a match block and the formatting thinks its for the proceeding line of code. Instead of using a code comment add a panic so the unit test fails if a new variant is added to `network::constants::Network`.
This commit is contained in:
parent
3ec8a12428
commit
296f2ed82c
|
@ -271,12 +271,13 @@ mod test {
|
||||||
// Compare strings because the spec specifically states how the chain hash must encode to hex.
|
// Compare strings because the spec specifically states how the chain hash must encode to hex.
|
||||||
assert_eq!(got, want);
|
assert_eq!(got, want);
|
||||||
|
|
||||||
|
#[allow(unreachable_patterns)] // This is specifically trying to catch later added variants.
|
||||||
match network {
|
match network {
|
||||||
Network::Bitcoin => {},
|
Network::Bitcoin => {},
|
||||||
Network::Testnet => {},
|
Network::Testnet => {},
|
||||||
Network::Signet => {},
|
Network::Signet => {},
|
||||||
Network::Regtest => {},
|
Network::Regtest => {},
|
||||||
// Update ChainHash::using_genesis_block and chain_hash_genesis_block with new variants.
|
_ => panic!("Update ChainHash::using_genesis_block and chain_hash_genesis_block with new variants"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue