summaryrefslogtreecommitdiffstats
path: root/openpgp/src/parse/mpis.rs
diff options
context:
space:
mode:
authorJustus Winter <justus@sequoia-pgp.org>2018-11-16 11:04:36 +0100
committerJustus Winter <justus@sequoia-pgp.org>2018-12-14 14:05:21 +0100
commitd411fb80983a4d4ebb9f023599c38e34a26551e7 (patch)
treefc970ff950923f7c400b24163f4079b3c6ba48cf /openpgp/src/parse/mpis.rs
parent251541318fdf453c5d756794b906cce2fd69b675 (diff)
openpgp: Introduce trait Parse.
- Trait Parse introduces a uniform interface to parse packets, messages, keys, and related data structures.
Diffstat (limited to 'openpgp/src/parse/mpis.rs')
-rw-r--r--openpgp/src/parse/mpis.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/openpgp/src/parse/mpis.rs b/openpgp/src/parse/mpis.rs
index c73554ea..6e18880a 100644
--- a/openpgp/src/parse/mpis.rs
+++ b/openpgp/src/parse/mpis.rs
@@ -451,6 +451,7 @@ impl mpis::Signature {
#[test]
fn mpis_parse_test() {
+ use super::Parse;
use std::io::Cursor;
use PublicKeyAlgorithm::*;
@@ -492,7 +493,7 @@ fn mpis_parse_test() {
}
// The number 511.
- let mpi = MPI::parse_naked(Cursor::new(b"\x00\x09\x01\xff".to_vec())).unwrap();
+ let mpi = MPI::from_bytes(b"\x00\x09\x01\xff").unwrap();
assert_eq!(mpi.value.len(), 2);
assert_eq!(mpi.bits, 9);
assert_eq!(mpi.value[0], 1);
@@ -500,5 +501,5 @@ fn mpis_parse_test() {
// The number 1, incorrectly encoded (the length should be 1,
// not 2).
- assert!(MPI::parse_naked(Cursor::new(b"\x00\x02\x01".to_vec())).is_err());
+ assert!(MPI::from_bytes(b"\x00\x02\x01").is_err());
}