fix mailparsing test

This commit is contained in:
dignifiedquire
2019-11-30 18:49:15 +01:00
parent 7d3a56a870
commit 64fcd56998

View File

@@ -377,41 +377,29 @@ mod tests {
}
}
// FIXME: https://github.com/staktrace/mailparse/issues/49
// #[test]
// fn test_mailmime_parse() {
// let plain = b"Chat-Disposition-Notification-To: hello@world.de
// Chat-Group-ID: CovhGgau8M-
// Chat-Group-Name: Delta Chat Dev
// Subject: =?utf-8?Q?Chat=3A?= Delta Chat =?utf-8?Q?Dev=3A?= sidenote for
// =?utf-8?Q?all=3A?= rust core master ...
// Content-Type: text/plain; charset=\"utf-8\"; protected-headers=\"v1\"
// Content-Transfer-Encoding: quoted-printable
#[test]
fn test_mailmime_parse() {
let plain = b"Chat-Disposition-Notification-To: hello@world.de
Chat-Group-ID: CovhGgau8M-
Chat-Group-Name: Delta Chat Dev
Subject: =?utf-8?Q?Chat=3A?= Delta Chat =?utf-8?Q?Dev=3A?= sidenote for
=?utf-8?Q?all=3A?= rust core master ...
Content-Type: text/plain; charset=\"utf-8\"; protected-headers=\"v1\"
Content-Transfer-Encoding: quoted-printable
// sidenote for all: things are trick atm recomm=
// end not to try to run with desktop or ios unless you are ready to hunt bugs
sidenote for all: things are trick atm recomm=
end not to try to run with desktop or ios unless you are ready to hunt bugs
// -- =20
// Sent with my Delta Chat Messenger: https://delta.chat";
// let mail = mailparse::parse_mail(plain).expect("failed to parse valid message");
-- =20
Sent with my Delta Chat Messenger: https://delta.chat";
let mail = mailparse::parse_mail(plain).expect("failed to parse valid message");
// println!(
// "{:?}",
// mail.headers
// .iter()
// .map(|h| (h.get_key(), h.get_value()))
// .collect::<Vec<_>>()
// );
// assert_eq!(mail.headers.len(), 6);
// assert_eq!(
// mail.get_body().unwrap(),
// " sidenote for all: things are trick atm recomm=
// end not to try to run with desktop or ios unless you are ready to hunt bugs
// -- =20
// Sent with my Delta Chat Messenger: https://delta.chat"
// );
// }
assert_eq!(mail.headers.len(), 6);
assert!(
mail.get_body().unwrap().starts_with(
"sidenote for all: things are trick atm recommend not to try to run with desktop or ios unless you are ready to hunt bugs")
);
}
mod load_or_generate_self_public_key {
use super::*;