summaryrefslogtreecommitdiffstats
path: root/openpgp
diff options
context:
space:
mode:
authorJustus Winter <justus@sequoia-pgp.org>2020-03-30 18:15:16 +0200
committerJustus Winter <justus@sequoia-pgp.org>2020-03-30 18:15:16 +0200
commitcaeffd92f3806816e913c0642e8b1b16484e15ea (patch)
treecced0a47c0d9861165cbf8a6adf3ca3bbdac86d9 /openpgp
parent36f0499e08c2de7b4cb2083f933990b45a598bd1 (diff)
openpgp: Add test for PacketPileParser::next.
Diffstat (limited to 'openpgp')
-rw-r--r--openpgp/src/parse/packet_pile_parser.rs20
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