diff options
author | Skyler Hawthorne | 2022-06-11 03:35:34 +0000 |
---|---|---|
committer | Skyler Hawthorne | 2022-06-19 04:00:31 +0000 |
commit | 665286c199b344c0bd65772156b5e460ff11d768 (patch) | |
tree | ea11016ae97144d4424bfbd4ec4d971d152493ea /helix-term/tests/test/helpers.rs | |
parent | 65bf6836b71e309a43d39b75a3fac7446604592b (diff) |
factor new Application with file arg to function
Diffstat (limited to 'helix-term/tests/test/helpers.rs')
-rw-r--r-- | helix-term/tests/test/helpers.rs | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/helix-term/tests/test/helpers.rs b/helix-term/tests/test/helpers.rs index 894fb674..8f2501e6 100644 --- a/helix-term/tests/test/helpers.rs +++ b/helix-term/tests/test/helpers.rs @@ -1,4 +1,4 @@ -use std::{io::Write, time::Duration}; +use std::{io::Write, path::PathBuf, time::Duration}; use anyhow::bail; use crossterm::event::{Event, KeyEvent}; @@ -199,3 +199,15 @@ pub fn new_readonly_tempfile() -> anyhow::Result<NamedTempFile> { file.as_file_mut().set_permissions(perms)?; Ok(file) } + +/// Creates a new Application with default config that opens the given file +/// path +pub fn app_with_file<P: Into<PathBuf>>(path: P) -> anyhow::Result<Application> { + Application::new( + Args { + files: vec![(path.into(), helix_core::Position::default())], + ..Default::default() + }, + Config::default(), + ) +} |