Skip to content

Commit 8314dbb

Browse files
committed
f Add proptests dependency
1 parent 823706c commit 8314dbb

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ tokio = { version = "1", default-features = false, features = [ "rt-multi-thread
5656
electrsd = { version = "0.22.0", features = ["legacy", "esplora_a33e97e1", "bitcoind_23_0"] }
5757
electrum-client = "0.12.0"
5858
once_cell = "1.16.0"
59+
proptest = "1.0.0"
5960

6061
[profile.release]
6162
panic = "abort"

src/peer_store.rs

+8
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ impl TryFrom<String> for PeerInfo {
174174
mod tests {
175175
use super::*;
176176
use crate::tests::test_utils::TestPersister;
177+
use proptest::prelude::*;
177178
use std::str::FromStr;
178179

179180
#[test]
@@ -232,4 +233,11 @@ mod tests {
232233
.to_string();
233234
assert_eq!(Err(Error::PeerInfoParseFailed), PeerInfo::try_from(invalid_peer_info_str3));
234235
}
236+
237+
proptest! {
238+
#[test]
239+
fn peer_info_parsing_doesnt_crash(s in "\\PC*") {
240+
let _ = PeerInfo::try_from(s.to_string());
241+
}
242+
}
235243
}

0 commit comments

Comments
 (0)