From ac8fb89d56351fbc0017b8a7a8a4ddf53217ab60 Mon Sep 17 00:00:00 2001 From: Quentin Dufour Date: Fri, 5 Jan 2024 10:05:30 +0100 Subject: reformat cargo --- tests/behavior.rs | 24 ++++++++++++++++-------- tests/common/fragments.rs | 6 ++---- 2 files changed, 18 insertions(+), 12 deletions(-) (limited to 'tests') diff --git a/tests/behavior.rs b/tests/behavior.rs index 82fdc53..17f3a72 100644 --- a/tests/behavior.rs +++ b/tests/behavior.rs @@ -26,15 +26,18 @@ fn rfc3501_imap4rev1_base() { lmtp_handshake(lmtp_socket).context("handshake lmtp done")?; lmtp_deliver_email(lmtp_socket, Email::Multipart).context("mail delivered successfully")?; noop_exists(imap_socket).context("noop loop must detect a new email")?; - fetch_rfc822(imap_socket, Selection::FirstId, Email::Multipart).context("fetch rfc822 message, should be our first message")?; - copy(imap_socket, Selection::FirstId, Mailbox::Archive).context("copy message to the archive mailbox")?; + fetch_rfc822(imap_socket, Selection::FirstId, Email::Multipart) + .context("fetch rfc822 message, should be our first message")?; + copy(imap_socket, Selection::FirstId, Mailbox::Archive) + .context("copy message to the archive mailbox")?; append_email(imap_socket, Email::Basic).context("insert email in INBOX")?; // SEARCH IS NOT IMPLEMENTED YET //search(imap_socket).expect("search should return something"); add_flags_email(imap_socket, Selection::FirstId, Flag::Deleted) .context("should add delete flag to the email")?; expunge(imap_socket).context("expunge emails")?; - rename_mailbox(imap_socket, Mailbox::Archive, Mailbox::Drafts).context("Archive mailbox is renamed Drafts")?; + rename_mailbox(imap_socket, Mailbox::Archive, Mailbox::Drafts) + .context("Archive mailbox is renamed Drafts")?; delete_mailbox(imap_socket, Mailbox::Drafts).context("Drafts mailbox is deleted")?; Ok(()) }) @@ -53,13 +56,16 @@ fn rfc3691_imapext_unselect() { login(imap_socket, Account::Alice).context("login test")?; select(imap_socket, Mailbox::Inbox, None).context("select inbox")?; noop_exists(imap_socket).context("noop loop must detect a new email")?; - add_flags_email(imap_socket, Selection::FirstId, Flag::Deleted).context("add delete flags to the email")?; + add_flags_email(imap_socket, Selection::FirstId, Flag::Deleted) + .context("add delete flags to the email")?; unselect(imap_socket) .context("unselect inbox while preserving email with the \\Delete flag")?; select(imap_socket, Mailbox::Inbox, Some(1)).context("select inbox again")?; - fetch_rfc822(imap_socket, Selection::FirstId, Email::Basic).context("message is still present")?; + fetch_rfc822(imap_socket, Selection::FirstId, Email::Basic) + .context("message is still present")?; close(imap_socket).context("close inbox and expunge message")?; - select(imap_socket, Mailbox::Inbox, Some(0)).context("select inbox again and check it's empty")?; + select(imap_socket, Mailbox::Inbox, Some(0)) + .context("select inbox again and check it's empty")?; Ok(()) }) @@ -94,7 +100,8 @@ fn rfc6851_imapext_move() { lmtp_deliver_email(lmtp_socket, Email::Basic).context("mail delivered successfully")?; noop_exists(imap_socket).context("noop loop must detect a new email")?; - r#move(imap_socket, Selection::FirstId, Mailbox::Archive).context("message from inbox moved to archive")?; + r#move(imap_socket, Selection::FirstId, Mailbox::Archive) + .context("message from inbox moved to archive")?; unselect(imap_socket) .context("unselect inbox while preserving email with the \\Delete flag")?; @@ -116,5 +123,6 @@ fn rfc7888_imapext_literal() { login_with_literal(imap_socket, Account::Alice).context("use literal to connect Alice")?; Ok(()) - }).expect("test fully run"); + }) + .expect("test fully run"); } diff --git a/tests/common/fragments.rs b/tests/common/fragments.rs index 3ed14cc..2e2fbd4 100644 --- a/tests/common/fragments.rs +++ b/tests/common/fragments.rs @@ -52,7 +52,7 @@ pub enum Mailbox { pub enum Flag { Deleted, - Important + Important, } pub enum Email { @@ -287,8 +287,6 @@ pub fn append_email(imap: &mut TcpStream, content: Email) -> Result<()> { Ok(()) } - - pub fn add_flags_email(imap: &mut TcpStream, selection: Selection, flag: Flag) -> Result<()> { let mut buffer: [u8; 1500] = [0; 1500]; assert!(matches!(selection, Selection::FirstId)); @@ -390,7 +388,7 @@ pub fn enable(imap: &mut TcpStream, ask: Enable, done: Option) -> Result Some(Enable::Utf8Accept) => { assert_eq!(srv_msg.lines().count(), 2); assert!(srv_msg.contains("* ENABLED UTF8=ACCEPT")); - }, + } _ => unimplemented!(), } -- cgit v1.2.3