More through testing of select and examine

This commit is contained in:
Matt McCoy 2016-06-22 21:25:48 -04:00
parent 808640e00d
commit 923339e5f0
2 changed files with 4 additions and 4 deletions

View file

@ -383,7 +383,7 @@ mod tests {
exists: 1, exists: 1,
recent: 1, recent: 1,
unseen: Some(1), unseen: Some(1),
permanent_flags: None, permanent_flags: Some(String::from("()")),
uid_next: Some(2), uid_next: Some(2),
uid_validity: Some(1257842737) uid_validity: Some(1257842737)
}; };
@ -399,7 +399,7 @@ mod tests {
#[test] #[test]
fn select() { fn select() {
let response = b"* FLAGS (\\Answered \\Flagged \\Deleted \\Seen \\Draft)\r\n\ let response = b"* FLAGS (\\Answered \\Flagged \\Deleted \\Seen \\Draft)\r\n\
* OK [PERMANENTFLAGS ()] Read-only mailbox.\r\n\ * OK [PERMANENTFLAGS (\\* \\Answered \\Flagged \\Deleted \\Draft \\Seen)] Read-only mailbox.\r\n\
* 1 EXISTS\r\n\ * 1 EXISTS\r\n\
* 1 RECENT\r\n\ * 1 RECENT\r\n\
* OK [UNSEEN 1] First unseen.\r\n\ * OK [UNSEEN 1] First unseen.\r\n\
@ -411,7 +411,7 @@ mod tests {
exists: 1, exists: 1,
recent: 1, recent: 1,
unseen: Some(1), unseen: Some(1),
permanent_flags: None, permanent_flags: Some(String::from("(\\* \\Answered \\Flagged \\Deleted \\Draft \\Seen)")),
uid_next: Some(2), uid_next: Some(2),
uid_validity: Some(1257842737) uid_validity: Some(1257842737)
}; };

View file

@ -50,7 +50,7 @@ pub fn parse_select_or_examine(lines: Vec<String>) -> Result<Mailbox> {
let uid_next_regex = Regex::new(r"^\* OK \[UIDNEXT (\d+)\](.*)\r\n").unwrap(); let uid_next_regex = Regex::new(r"^\* OK \[UIDNEXT (\d+)\](.*)\r\n").unwrap();
let permanent_flags_regex = Regex::new(r"^\* OK \[PERMANENTFLAGS (.+)\]\r\n").unwrap(); let permanent_flags_regex = Regex::new(r"^\* OK \[PERMANENTFLAGS (.+)\](.*)\r\n").unwrap();
//Check Ok //Check Ok
match parse_response_ok(lines.clone()) { match parse_response_ok(lines.clone()) {