From 337d1a47c489ec296fd305e7407c66cc9c43810c Mon Sep 17 00:00:00 2001 From: Quentin Dufour Date: Sun, 16 Jul 2023 10:09:22 +0200 Subject: [PATCH] test boundary --- src/fragments/part.rs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/fragments/part.rs b/src/fragments/part.rs index 04b5e50..f9f0400 100644 --- a/src/fragments/part.rs +++ b/src/fragments/part.rs @@ -24,6 +24,7 @@ pub enum PartNode<'a> { Composite(PartHeader<'a>, Vec>), } +#[derive(Debug, PartialEq)] pub enum Delimiter { Next, Last @@ -44,6 +45,18 @@ mod tests { use super::*; #[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)) + ); } }