Skip to content

Commit

Permalink
test: fix 3 blind spots reported by cargo-mutants
Browse files Browse the repository at this point in the history
  • Loading branch information
paolobarbolini committed Nov 22, 2024
1 parent 71dc23d commit 972c4fc
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/body/base64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ pub fn encode(b: &[u8], w: &mut dyn Write) -> fmt::Result {
pub fn encoded_len(input_len: usize) -> usize {
let mut base64_len = input_len / 3 * 4;
if input_len % 3 != 0 {
base64_len += 4 - base64_len % 4;
base64_len += 4;
}
let mut crlf_len = base64_len / LINE_LEN * CRLF.len();
if crlf_len >= CRLF.len() && base64_len % LINE_LEN == 0 {
Expand Down
8 changes: 7 additions & 1 deletion src/body/chooser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,13 @@ mod tests {

#[test]
fn not_too_long_multiline() {
let input = concat!("0123\n", "4567").as_bytes();
let input = concat!(
"0123\n",
"4567\n",
"00000000000000000000000000000000000000000\n",
"89"
)
.as_bytes();

assert!(!line_too_long(input));
}
Expand Down
8 changes: 8 additions & 0 deletions src/headers/rfc2231.rs
Original file line number Diff line number Diff line change
Expand Up @@ -372,4 +372,12 @@ mod tests {
}
}
}

#[test]
#[should_panic(expected = "`key` must only be composed of ascii alphanumeric chars")]
fn non_ascii_key() {
let mut s = String::new();
let mut w = EmailWriter::new(&mut s, 0, 0, true);
let _ = encode("📬", "", &mut w);
}
}

0 comments on commit 972c4fc

Please sign in to comment.