test multipart

This commit is contained in:
Quentin 2023-07-04 14:47:28 +02:00
parent cb7b767271
commit 3e8f374723
Signed by: quentin
GPG key ID: E9602264D639FF68

View file

@ -328,6 +328,8 @@ pub fn content_type(input: &str) -> IResult<&str, Type> {
.into_iter() .into_iter()
.partition(|p| matches!(p, Parameter::Boundary(_))); .partition(|p| matches!(p, Parameter::Boundary(_)));
println!("{:?} //// {:?}", boundary_param, unknown_parameters);
// @FIXME: if multiple boundary value is set, only the // @FIXME: if multiple boundary value is set, only the
// first one is picked. We should check that it makes // first one is picked. We should check that it makes
// sense with other implementation. // sense with other implementation.
@ -460,6 +462,18 @@ mod tests {
); );
} }
#[test]
fn test_content_type_multipart() {
assert_eq!(
Type::try_from(&lazy::Type("multipart/mixed;\r\n\tboundary=\"--==_mimepart_64a3f2c69114f_2a13d020975fe\";\r\n\tcharset=UTF-8")),
Ok(Type::Multipart(MultipartDesc {
subtype: MultipartSubtype::Mixed,
boundary: "--==_mimepart_64a3f2c69114f_2a13d020975fe".into(),
unknown_parameters: vec![Parameter::Charset(EmailCharset::UTF_8)],
}))
);
}
/* #[test] /* #[test]
fn test_parameter() { fn test_parameter() {
assert_eq!( assert_eq!(