test boundary

This commit is contained in:
Quentin 2023-07-16 10:09:22 +02:00
parent 52dc154616
commit 337d1a47c4
Signed by: quentin
GPG key ID: E9602264D639FF68

View file

@ -24,6 +24,7 @@ pub enum PartNode<'a> {
Composite(PartHeader<'a>, Vec<PartNode<'a>>), Composite(PartHeader<'a>, Vec<PartNode<'a>>),
} }
#[derive(Debug, PartialEq)]
pub enum Delimiter { pub enum Delimiter {
Next, Next,
Last Last
@ -44,6 +45,18 @@ mod tests {
use super::*; use super::*;
#[test] #[test]
fn test_boundary() { fn test_boundary_next() {
assert_eq!(
boundary(b"hello")(b"\r\n--hello\r\n"),
Ok((&b""[..], Delimiter::Next))
);
}
#[test]
fn test_boundary_last() {
assert_eq!(
boundary(b"hello")(b"\r\n--hello--\r\n"),
Ok((&b""[..], Delimiter::Last))
);
} }
} }