From 4529c326c6eab2a08c38c511420aff5088ad34f8 Mon Sep 17 00:00:00 2001 From: Alexander Krotov Date: Tue, 7 Jan 2020 11:26:50 +0300 Subject: [PATCH] Restore newlines and remove semicolon in test_parse_first_addr --- src/mimeparser.rs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/mimeparser.rs b/src/mimeparser.rs index 95fba5bff..77ee421de 100644 --- a/src/mimeparser.rs +++ b/src/mimeparser.rs @@ -1130,8 +1130,8 @@ mod tests { fn test_parse_first_addr() { let context = dummy_context(); let raw = b"From: hello@one.org, world@two.org\n\ - Chat-Disposition-Notification-To: wrong - Content-Type: text/plain; + Chat-Disposition-Notification-To: wrong\n\ + Content-Type: text/plain\n\ Chat-Version: 1.0\n\ \n\ test1\n\ @@ -1142,8 +1142,13 @@ mod tests { let of = mimeparser.parse_first_addr(HeaderDef::From_).unwrap(); assert_eq!(of, mailparse::addrparse("hello@one.org").unwrap()[0]); - let of = mimeparser.parse_first_addr(HeaderDef::ChatDispositionNotificationTo); - assert!(of.is_none()); + // XXX: the address does not contain "@", so it is wrong + // addr-spec according to RFC 2822, but mailparse still parses + // is as an address. + let of = mimeparser + .parse_first_addr(HeaderDef::ChatDispositionNotificationTo) + .unwrap(); + assert_eq!(of, mailparse::addrparse("wrong").unwrap()[0]); } #[test]