Skip to content

Commit b5a1100

Browse files
soywodduesee
authored andcommitted
tests: add vanished tests
1 parent a9886fc commit b5a1100

1 file changed

Lines changed: 39 additions & 0 deletions

File tree

imap-codec/src/response.rs

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -547,6 +547,45 @@ mod tests {
547547
]);
548548
}
549549

550+
#[cfg(feature = "ext_condstore_qresync")]
551+
#[test]
552+
fn test_kat_inverse_response_vanished() {
553+
kat_inverse_response(&[
554+
(
555+
b"* VANISHED 1\r\n".as_ref(),
556+
b"".as_ref(),
557+
Response::Data(Data::Vanished {
558+
earlier: false,
559+
known_uids: "1".try_into().unwrap(),
560+
}),
561+
),
562+
(
563+
b"* VANISHED 1:5,7\r\n".as_ref(),
564+
b"".as_ref(),
565+
Response::Data(Data::Vanished {
566+
earlier: false,
567+
known_uids: "1:5,7".try_into().unwrap(),
568+
}),
569+
),
570+
(
571+
b"* VANISHED (EARLIER) 1:5,7,9:11\r\n".as_ref(),
572+
b"".as_ref(),
573+
Response::Data(Data::Vanished {
574+
earlier: true,
575+
known_uids: "1:5,7,9:11".try_into().unwrap(),
576+
}),
577+
),
578+
]);
579+
}
580+
581+
// NOTE: regression test for https://github.com/duesee/imap-codec/issues/705
582+
#[cfg(feature = "ext_condstore_qresync")]
583+
#[test]
584+
fn test_parse_response_vanished_with_leading_seq_rejected() {
585+
assert!(response_data(b"* 5 VANISHED 1:3\r\n").is_err());
586+
assert!(response_data(b"* 5 VANISHED (EARLIER) 1:3\r\n").is_err());
587+
}
588+
550589
#[test]
551590
fn test_kat_inverse_response_status() {
552591
kat_inverse_response(&[

0 commit comments

Comments
 (0)