diff options
author | Tim Oram <dev@mitmaro.ca> | 2024-02-12 20:05:50 -0330 |
---|---|---|
committer | Tim Oram <dev@mitmaro.ca> | 2024-02-15 20:27:06 -0330 |
commit | 85fc458214aeac22ae2c38478703eac64b946544 (patch) | |
tree | a05807da54c0a7eb6129cce3ae114672e2ad9134 | |
parent | c3c646f7d75176666e6ab581ae9bb57577d12ce7 (diff) |
Move todo_file testutils to test_helpers
-rw-r--r-- | src/module/modules.rs | 2 | ||||
-rw-r--r-- | src/test_helpers.rs | 2 | ||||
-rw-r--r-- | src/test_helpers/with_todo_file.rs (renamed from src/todo_file/testutil.rs) | 2 | ||||
-rw-r--r-- | src/testutil/module_test.rs | 4 | ||||
-rw-r--r-- | src/testutil/process_test.rs | 3 | ||||
-rw-r--r-- | src/todo_file.rs | 3 | ||||
-rw-r--r-- | src/todo_file/search.rs | 2 |
7 files changed, 8 insertions, 10 deletions
diff --git a/src/module/modules.rs b/src/module/modules.rs index 012d292..e29aaee 100644 --- a/src/module/modules.rs +++ b/src/module/modules.rs @@ -69,7 +69,7 @@ impl ModuleProvider for Modules { #[cfg(test)] mod tests { use super::*; - use crate::{test_helpers::with_temp_repository, todo_file::testutil::with_todo_file}; + use crate::test_helpers::{with_temp_repository, with_todo_file}; pub(crate) fn modules_test<C>(callback: C) where C: FnOnce(Modules) { diff --git a/src/test_helpers.rs b/src/test_helpers.rs index c9d5930..1bebb48 100644 --- a/src/test_helpers.rs +++ b/src/test_helpers.rs @@ -10,6 +10,7 @@ mod with_event_handler; mod with_git_config; mod with_temp_bare_repository; mod with_temp_repository; +mod with_todo_file; pub(crate) static JAN_2021_EPOCH: i64 = 1_609_459_200; @@ -23,4 +24,5 @@ pub(crate) use self::{ with_git_config::with_git_config, with_temp_bare_repository::with_temp_bare_repository, with_temp_repository::with_temp_repository, + with_todo_file::{with_todo_file, TodoFileTestContext}, }; diff --git a/src/todo_file/testutil.rs b/src/test_helpers/with_todo_file.rs index 5ca9480..10cf213 100644 --- a/src/todo_file/testutil.rs +++ b/src/test_helpers/with_todo_file.rs @@ -19,7 +19,7 @@ impl Debug for TodoFileTestContext { fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { f.debug_struct("TodoFileTestContext") .field("todo_file", &self.todo_file) - .field("filepath", &self.todo_file.filepath) + .field("filepath", &self.todo_file.get_filepath()) .finish_non_exhaustive() } } diff --git a/src/testutil/module_test.rs b/src/testutil/module_test.rs index c84c117..f73d4f2 100644 --- a/src/testutil/module_test.rs +++ b/src/testutil/module_test.rs @@ -4,8 +4,8 @@ use crate::{ input::Event, module::{Module, State}, process::Results, - test_helpers::{with_event_handler, EventHandlerTestContext}, - todo_file::{testutil::with_todo_file, TodoFile}, + test_helpers::{with_event_handler, with_todo_file, EventHandlerTestContext}, + todo_file::TodoFile, view::{ testutil::{with_view_state, TestContext as ViewContext}, RenderContext, diff --git a/src/testutil/process_test.rs b/src/testutil/process_test.rs index 5c26308..a922be6 100644 --- a/src/testutil/process_test.rs +++ b/src/testutil/process_test.rs @@ -8,9 +8,8 @@ use crate::{ module::{self, ModuleHandler}, process::Process, runtime::ThreadStatuses, - test_helpers::{with_event_handler, EventHandlerTestContext}, + test_helpers::{with_event_handler, with_todo_file, EventHandlerTestContext}, testutil::{with_search, SearchTestContext}, - todo_file::testutil::with_todo_file, view::testutil::{with_view_state, TestContext as ViewContext}, }; diff --git a/src/todo_file.rs b/src/todo_file.rs index 9c0a32d..f37f1e5 100644 --- a/src/todo_file.rs +++ b/src/todo_file.rs @@ -10,9 +10,6 @@ mod history; mod line; mod line_parser; mod search; -#[cfg(test)] -#[cfg(not(tarpaulin_include))] -pub(crate) mod testutil; mod todo_file_options; mod utils; diff --git a/src/todo_file/search.rs b/src/todo_file/search.rs index 641b5a3..5e315cc 100644 --- a/src/todo_file/search.rs +++ b/src/todo_file/search.rs @@ -160,7 +160,7 @@ mod tests { use claims::{assert_none, assert_some_eq}; use super::*; - use crate::todo_file::testutil::with_todo_file; + use crate::test_helpers::with_todo_file; #[test] fn search_empty_rebase_file() { |