From 2342365d986389d8009ea1de329126e812ad4ed6 Mon Sep 17 00:00:00 2001 From: Simon Thormeyer Date: Sat, 27 Apr 2024 10:08:00 +0200 Subject: [PATCH] build: move SimpleMessageDisplay to test helpers --- index/src/index.rs | 2 +- litt/tests/tests.rs | 2 +- search/src/search.rs | 2 +- shared/src/message_display.rs | 4 ---- shared/src/test_helpers.rs | 5 +++++ 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/index/src/index.rs b/index/src/index.rs index 0357ca7..4f26177 100644 --- a/index/src/index.rs +++ b/index/src/index.rs @@ -487,8 +487,8 @@ impl<'a, T: MessageDisplay> Index<'a, T> { #[cfg(test)] mod tests { use super::*; - use litt_shared::message_display::SimpleMessageDisplay; use litt_shared::test_helpers::cleanup_dir_and_file; + use litt_shared::test_helpers::SimpleMessageDisplay; use once_cell::sync::Lazy; use serial_test::serial; use std::panic; diff --git a/litt/tests/tests.rs b/litt/tests/tests.rs index b0f506b..69dfda7 100644 --- a/litt/tests/tests.rs +++ b/litt/tests/tests.rs @@ -3,9 +3,9 @@ use std::panic; extern crate litt_search; use litt_index::index::Index; use litt_search::search::Search; -use litt_shared::message_display::SimpleMessageDisplay; use litt_shared::search_schema::SearchSchema; use litt_shared::test_helpers::cleanup_litt_files; +use litt_shared::test_helpers::SimpleMessageDisplay; const TEST_DIR_NAME: &str = "../resources"; const TEST_FILE_NAME: &str = "test.pdf"; diff --git a/search/src/search.rs b/search/src/search.rs index c544148..a2fc4ae 100644 --- a/search/src/search.rs +++ b/search/src/search.rs @@ -190,7 +190,7 @@ impl<'a, T: MessageDisplay> Search<'a, T> { #[cfg(test)] mod tests { - use litt_shared::message_display::SimpleMessageDisplay; + use litt_shared::test_helpers::SimpleMessageDisplay; use std::panic; use litt_shared::test_helpers::cleanup_litt_files; diff --git a/shared/src/message_display.rs b/shared/src/message_display.rs index 1412abb..12cce5c 100644 --- a/shared/src/message_display.rs +++ b/shared/src/message_display.rs @@ -13,7 +13,3 @@ pub trait MessageDisplay: Sync { } } } - -pub struct SimpleMessageDisplay; - -impl MessageDisplay for SimpleMessageDisplay {} diff --git a/shared/src/test_helpers.rs b/shared/src/test_helpers.rs index b413acb..982ac20 100644 --- a/shared/src/test_helpers.rs +++ b/shared/src/test_helpers.rs @@ -1,6 +1,7 @@ use std::fs::{remove_dir_all, remove_file}; use std::path::PathBuf; +use crate::message_display::MessageDisplay; use crate::LITT_DIRECTORY_NAME; pub fn cleanup_dir_and_file(directory: &str, file_name: &str) { @@ -13,3 +14,7 @@ pub fn cleanup_litt_files(directory: &str) { let index_path = PathBuf::from(directory).join(LITT_DIRECTORY_NAME); _ = std::fs::remove_dir_all(index_path); } + +pub struct SimpleMessageDisplay; + +impl MessageDisplay for SimpleMessageDisplay {}