Witness human-readable serde test

This commit is contained in:
Dr Maxim Orlovsky 2022-03-22 09:56:32 +01:00 committed by Tobin C. Harding
parent 68577dfb50
commit a1df62a3d9
1 changed files with 14 additions and 0 deletions

View File

@ -489,6 +489,20 @@ mod test {
assert_eq!(new_witness_format, back); assert_eq!(new_witness_format, back);
} }
#[cfg(feature = "serde")]
#[test]
fn test_serde_human() {
use serde_json;
let witness = Witness::from_vec(vec![vec![0u8, 123, 75], vec![2u8, 6, 3, 7, 8]]);
let json = serde_json::to_string(&witness).unwrap();
assert_eq!(json, r#"["007b4b","0206030708"]"#);
let back: Witness = serde_json::from_str(&json).unwrap();
assert_eq!(witness, back);
}
} }