From 73d5b24e9847cf7dd033041e97f59274dece0b3d Mon Sep 17 00:00:00 2001 From: Manos Pitsidianakis Date: Mon, 1 Jan 2024 10:44:31 +0200 Subject: [PATCH] melib/tests: merge integration tests in one crate Saves about 0.5 seconds from compilation and runtime. Signed-off-by: Manos Pitsidianakis --- .../{ => integration}/generating_email.rs | 2 +- melib/tests/integration/main.rs | 25 +++++++++++++++++++ melib/tests/{ => integration}/mbox_parse.rs | 11 ++++---- 3 files changed, 32 insertions(+), 6 deletions(-) rename melib/tests/{ => integration}/generating_email.rs (94%) create mode 100644 melib/tests/integration/main.rs rename melib/tests/{ => integration}/mbox_parse.rs (87%) diff --git a/melib/tests/generating_email.rs b/melib/tests/integration/generating_email.rs similarity index 94% rename from melib/tests/generating_email.rs rename to melib/tests/integration/generating_email.rs index 3ff7326d..f7c49893 100644 --- a/melib/tests/generating_email.rs +++ b/melib/tests/integration/generating_email.rs @@ -42,7 +42,7 @@ fn test_build_draft() { let raw = raw.replace(boundary_str, ""); - let mut gz = GzDecoder::new(include_bytes!("./data/generated_email.eml.gz").as_slice()); + let mut gz = GzDecoder::new(include_bytes!("../data/generated_email.eml.gz").as_slice()); let mut s = String::new(); gz.read_to_string(&mut s).unwrap(); diff --git a/melib/tests/integration/main.rs b/melib/tests/integration/main.rs new file mode 100644 index 00000000..8dbc538d --- /dev/null +++ b/melib/tests/integration/main.rs @@ -0,0 +1,25 @@ +// +// meli +// +// Copyright 2019 Manos Pitsidianakis +// +// This file is part of meli. +// +// meli is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// meli is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with meli. If not, see . +// + +mod generating_email; +mod mbox_parse; + +fn main() {} diff --git a/melib/tests/mbox_parse.rs b/melib/tests/integration/mbox_parse.rs similarity index 87% rename from melib/tests/mbox_parse.rs rename to melib/tests/integration/mbox_parse.rs index f16829ff..83c4ce44 100644 --- a/melib/tests/mbox_parse.rs +++ b/melib/tests/integration/mbox_parse.rs @@ -38,10 +38,11 @@ fn test_mbox_parse() { } { - let sha1dc_diet_op = - gz_to_string(include_bytes!("./data/PATCH-Put-sha1dc-on-a-diet_op.mbox.gz").as_slice()); + let sha1dc_diet_op = gz_to_string( + include_bytes!("../data/PATCH-Put-sha1dc-on-a-diet_op.mbox.gz").as_slice(), + ); let sha1dc_diet_thread = - gz_to_string(include_bytes!("./data/PATCH-Put-sha1dc-on-a-diet.mbox.gz").as_slice()); + gz_to_string(include_bytes!("../data/PATCH-Put-sha1dc-on-a-diet.mbox.gz").as_slice()); let message_iter = MessageIterator { index: Arc::new(Mutex::new(HashMap::default())), @@ -70,10 +71,10 @@ fn test_mbox_parse() { { let git_am_op = gz_to_string( - include_bytes!("./data/git-am-breakage-with-MIME-decoding_op.mbox.gz").as_slice(), + include_bytes!("../data/git-am-breakage-with-MIME-decoding_op.mbox.gz").as_slice(), ); let git_am_thread = gz_to_string( - include_bytes!("./data/git-am-breakage-with-MIME-decoding.mbox.gz").as_slice(), + include_bytes!("../data/git-am-breakage-with-MIME-decoding.mbox.gz").as_slice(), ); let message_iter = MessageIterator {