Skip to content

Commit 1db492e

Browse files
authored
Add test for dovecot unsolicited OK progress message. (#196)
1 parent 18ebf56 commit 1db492e

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

src/parse.rs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -504,6 +504,28 @@ mod tests {
504504
assert_eq!(fetches[0].uid, Some(74));
505505
}
506506

507+
#[test]
508+
fn parse_fetches_w_dovecot_info() {
509+
// Dovecot will sometimes send informational unsolicited
510+
// OK messages while performing long operations.
511+
// * OK Searched 91% of the mailbox, ETA 0:01
512+
let lines = b"\
513+
* OK Searched 91% of the mailbox, ETA 0:01\r\n\
514+
* 37 FETCH (UID 74)\r\n";
515+
let (mut send, recv) = mpsc::channel();
516+
let fetches = parse_fetches(lines.to_vec(), &mut send).unwrap();
517+
assert_eq!(
518+
recv.try_recv(),
519+
Ok(UnsolicitedResponse::Ok {
520+
code: None,
521+
information: Some(String::from("Searched 91% of the mailbox, ETA 0:01")),
522+
})
523+
);
524+
assert_eq!(fetches.len(), 1);
525+
assert_eq!(fetches[0].message, 37);
526+
assert_eq!(fetches[0].uid, Some(74));
527+
}
528+
507529
#[test]
508530
fn parse_names_w_unilateral() {
509531
let lines = b"\

0 commit comments

Comments
 (0)