From f616cffef018fd72184175679ef3ba62b7aced55 Mon Sep 17 00:00:00 2001 From: Michael Zhang Date: Mon, 22 Feb 2021 22:50:39 -0600 Subject: [PATCH] Run tests on push --- .github/workflows/doc.yml | 2 +- .github/workflows/run-tests.yml | 19 +++++++++++++++++++ imap/src/parser/mod.rs | 2 +- src/mail/mod.rs | 4 +--- 4 files changed, 22 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/run-tests.yml diff --git a/.github/workflows/doc.yml b/.github/workflows/doc.yml index 1545f75..b617257 100644 --- a/.github/workflows/doc.yml +++ b/.github/workflows/doc.yml @@ -3,7 +3,7 @@ on: branches: - master -name: CI +name: publish-documentation jobs: doc: diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml new file mode 100644 index 0000000..4f0b215 --- /dev/null +++ b/.github/workflows/run-tests.yml @@ -0,0 +1,19 @@ +on: [push] + +name: run-tests + +jobs: + run_tests: + runs-on: ubuntu-latest + steps: + - name: checkout + uses: actions/checkout@v2 + + - name: rust + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + + - name: run tests + run: | + cargo test --all diff --git a/imap/src/parser/mod.rs b/imap/src/parser/mod.rs index 876c987..e86e365 100644 --- a/imap/src/parser/mod.rs +++ b/imap/src/parser/mod.rs @@ -345,7 +345,7 @@ mod tests { r#"* 12 FETCH (FLAGS (\Seen) INTERNALDATE "17-Jul-1996 02:44:25 -0700" RFC822.SIZE 4286 ENVELOPE ("Wed, 17 Jul 1996 02:23:25 -0700 (PDT)" "IMAP4rev1 WG mtg summary and minutes" (("Terry Gray" NIL "gray" "cac.washington.edu")) (("Terry Gray" NIL "gray" "cac.washington.edu")) (("Terry Gray" NIL "gray" "cac.washington.edu")) ((NIL NIL "imap" "cac.washington.edu")) ((NIL NIL "minutes" "CNRI.Reston.VA.US") ("John Klensin" NIL "KLENSIN" "MIT.EDU")) NIL NIL "") BODY ("TEXT" "PLAIN" ("CHARSET" "US-ASCII") NIL NIL "7BIT" 3028 92))"#, "\r\n", )), - Ok(Response::Fetch(12, vec![AttributeValue])) + Ok(Response::Fetch(12, vec![])) ); } } diff --git a/src/mail/mod.rs b/src/mail/mod.rs index a34d135..aa1cc4e 100644 --- a/src/mail/mod.rs +++ b/src/mail/mod.rs @@ -41,6 +41,7 @@ pub async fn run_mail( // TODO: gracefully shut down connection // just gonna drop the connection for now + // FUTURE TODO: possible to hash the connections and only reconn the ones that changed debug!("dropping all connections..."); for conn in curr_conn.drain(0..) { conn.abort(); @@ -101,9 +102,6 @@ async fn imap_main(acct: MailAccountConfig) -> Result<()> { debug!("authentication successful!"); - // debug!("sending CAPABILITY"); - // let result = unauth.capabilities().await?; - loop { debug!("listing all emails..."); authed.list().await?;