Add serde roundtrip tests

We have a TODO in the code to add serde roundtrip unit tests, seems
reasonable so do it and remove the TODO.
This commit is contained in:
Tobin C. Harding 2022-09-01 16:08:12 +10:00
parent 75949355a4
commit a8f9e8ad96
1 changed files with 7 additions and 1 deletions

View File

@ -951,7 +951,13 @@ mod tests {
"script round-trip failed for {}", "script round-trip failed for {}",
addr, addr,
); );
//TODO: add serde roundtrip after no-strason PR
#[cfg(feature = "serde")]
{
let ser = serde_json::to_string(addr).expect("failed to serialize address");
let back: Address = serde_json::from_str(&ser).expect("failed to deserialize address");
assert_eq!(back, *addr, "serde round-trip failed for {}", addr)
}
} }
#[test] #[test]