diff options
author | Justus Winter <justus@sequoia-pgp.org> | 2020-03-30 18:15:16 +0200 |
---|---|---|
committer | Justus Winter <justus@sequoia-pgp.org> | 2020-03-30 18:15:16 +0200 |
commit | caeffd92f3806816e913c0642e8b1b16484e15ea (patch) | |
tree | cced0a47c0d9861165cbf8a6adf3ca3bbdac86d9 /openpgp | |
parent | 36f0499e08c2de7b4cb2083f933990b45a598bd1 (diff) |
openpgp: Add test for PacketPileParser::next.
Diffstat (limited to 'openpgp')
-rw-r--r-- | openpgp/src/parse/packet_pile_parser.rs | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/openpgp/src/parse/packet_pile_parser.rs b/openpgp/src/parse/packet_pile_parser.rs index f8c90543..2390a26c 100644 --- a/openpgp/src/parse/packet_pile_parser.rs +++ b/openpgp/src/parse/packet_pile_parser.rs @@ -236,17 +236,31 @@ impl<'a> PacketPileParser<'a> { } #[test] -fn message_parser_test() { +fn test_recurse() -> Result<()> { let mut count = 0; let mut ppp = - PacketPileParser::from_bytes(crate::tests::key("public-key.gpg")) - .unwrap(); + PacketPileParser::from_bytes(crate::tests::key("public-key.gpg"))?; let mut ppr = ppp.recurse().unwrap(); while ppr.is_some() { count += 1; ppr = ppp.recurse().unwrap(); } assert_eq!(count, 61); + Ok(()) +} + +#[test] +fn test_next() -> Result<()> { + let mut count = 0; + let mut ppp = + PacketPileParser::from_bytes(crate::tests::key("public-key.gpg"))?; + let mut ppr = ppp.recurse().unwrap(); + while ppr.is_some() { + count += 1; + ppr = ppp.next().unwrap(); + } + assert_eq!(count, 61); + Ok(()) } /// Check that we can use the read interface to stream the contents of |