diff options
author | Justus Winter <justus@sequoia-pgp.org> | 2019-05-03 13:11:37 +0200 |
---|---|---|
committer | Justus Winter <justus@sequoia-pgp.org> | 2019-05-03 15:48:48 +0200 |
commit | 44b3e0fd800cb2ec2a3791083cf07b22f86751d8 (patch) | |
tree | f32e7971f8abe929e61bf552c41497e57c944571 /openpgp/tests | |
parent | be2f2497766ecd8008e0baedc0be60b679479049 (diff) |
openpgp: Improve test to also SerializeInto.
Diffstat (limited to 'openpgp/tests')
-rw-r--r-- | openpgp/tests/for-each-artifact.rs | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/openpgp/tests/for-each-artifact.rs b/openpgp/tests/for-each-artifact.rs index 8979ccaa..ec546a7c 100644 --- a/openpgp/tests/for-each-artifact.rs +++ b/openpgp/tests/for-each-artifact.rs @@ -5,7 +5,7 @@ use std::path::{Path, PathBuf}; extern crate sequoia_openpgp as openpgp; use openpgp::parse::*; -use openpgp::serialize::Serialize; +use openpgp::serialize::*; mod for_each_artifact { use super::*; @@ -18,6 +18,9 @@ mod for_each_artifact { p.serialize(&mut v)?; let q = openpgp::Packet::from_bytes(&v)?; assert_eq!(p, &q, "roundtripping {:?} failed", src); + let w = p.to_vec().unwrap(); + assert_eq!(v, w, + "Serialize and SerializeInto disagree on {:?}", p); Ok(()) }) }).unwrap(); @@ -37,6 +40,10 @@ mod for_each_artifact { p.as_tsk().serialize(&mut v)?; let q = openpgp::TPK::from_bytes(&v)?; assert_eq!(p, q, "roundtripping {:?} failed", src); + + let w = p.as_tsk().to_vec().unwrap(); + assert_eq!(v, w, + "Serialize and SerializeInto disagree on {:?}", p); Ok(()) }).unwrap(); } @@ -55,6 +62,10 @@ mod for_each_artifact { p.serialize(&mut v)?; let q = openpgp::Message::from_bytes(&v)?; assert_eq!(p, q, "roundtripping {:?} failed", src); + + let w = p.to_vec().unwrap(); + assert_eq!(v, w, + "Serialize and SerializeInto disagree on {:?}", p); Ok(()) }).unwrap(); } |