aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorQuentin Dufour <quentin@deuxfleurs.fr>2024-01-05 10:05:30 +0100
committerQuentin Dufour <quentin@deuxfleurs.fr>2024-01-05 10:05:30 +0100
commitac8fb89d56351fbc0017b8a7a8a4ddf53217ab60 (patch)
treea404d0ff5fd1ccd07a23b7111ca3b5ba3a92ffb6 /tests
parentcd74ae5e638a03e2656fb54aa09a976e6939e1e3 (diff)
downloadaerogramme-ac8fb89d56351fbc0017b8a7a8a4ddf53217ab60.tar.gz
aerogramme-ac8fb89d56351fbc0017b8a7a8a4ddf53217ab60.zip
reformat cargo
Diffstat (limited to 'tests')
-rw-r--r--tests/behavior.rs24
-rw-r--r--tests/common/fragments.rs6
2 files changed, 18 insertions, 12 deletions
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<Enable>) -> Result
Some(Enable::Utf8Accept) => {
assert_eq!(srv_msg.lines().count(), 2);
assert!(srv_msg.contains("* ENABLED UTF8=ACCEPT"));
- },
+ }
_ => unimplemented!(),
}