From 4634f4178bf669fc3287ee755495f4343c512a0e Mon Sep 17 00:00:00 2001 From: Paolo Barbolini Date: Wed, 27 Mar 2024 21:51:41 +0100 Subject: [PATCH] test(rfc2047): add second test --- src/headers/writer.rs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/headers/writer.rs b/src/headers/writer.rs index c099114..2dd5155 100644 --- a/src/headers/writer.rs +++ b/src/headers/writer.rs @@ -365,4 +365,24 @@ mod tests { ) ); } + + #[test] + fn double_spaces_issue_949_no_space() { + let mut s = "Subject: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA ".to_string(); + let line_len = s.len(); + + { + let mut w = EmailWriter::new(&mut s, line_len, 0, false, true); + w.folding().write_str("BBBBBBBBBBBBBBB").unwrap(); + crate::headers::rfc2047::encode("sélection", &mut w).unwrap(); + } + + assert_eq!( + s, + concat!( + "Subject: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA BBBBBBBBBBBBBBB=?utf-8?b?cw==?=\r\n", + " =?utf-8?b?w6lsZWN0aW9u?=", + ) + ); + } }