Skip to content

Commit

Permalink
build: move SimpleMessageDisplay to test helpers
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonThormeyer committed Apr 27, 2024
1 parent 5593d75 commit 2342365
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion index/src/index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion litt/tests/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
2 changes: 1 addition & 1 deletion search/src/search.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 0 additions & 4 deletions shared/src/message_display.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,3 @@ pub trait MessageDisplay: Sync {
}
}
}

pub struct SimpleMessageDisplay;

impl MessageDisplay for SimpleMessageDisplay {}
5 changes: 5 additions & 0 deletions shared/src/test_helpers.rs
Original file line number Diff line number Diff line change
@@ -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) {
Expand All @@ -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 {}

0 comments on commit 2342365

Please sign in to comment.