Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a failing test for addrparse_header #78

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions src/addrparse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1062,5 +1062,26 @@ mod tests {
.unwrap()
)])
);

let (parsed, _) = crate::parse_header(
b"To: foo <foo@example.org>,?UTF-8?B?Zm9v8J+Qm2Jhcg==?= <bar@example.org>",
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it intentional that there's no = between the , and the ?UTF bits? Because that's a pretty bad spec violation and I wouldn't want to try and detect that. Even if I add the =, mailparse doesn't handle this correctly, so there's still a bug that I need to fix, but I wanted to confirm that your original thing has the = character and the omission here is a typo.

)
.unwrap();
assert_eq!(
addrparse_header(&parsed).unwrap(),
MailAddrList(vec![
MailAddr::Single(
SingleInfo::new(Some("foo".to_string()), "foo@example.org".to_string())
.unwrap()
),
MailAddr::Single(
SingleInfo::new(
Some("foo\u{1f41b}bar".to_string()),
"bar@example.org".to_string()
)
.unwrap()
)
])
);
}
}