@@ -81,8 +81,10 @@ pub async fn test_key_sequence_with_input_text<T: Into<TestCase>>(
81 test_fn: &dyn Fn(&Application),
81 test_fn: &dyn Fn(&Application),
82) -> anyhow::Result<()> {
82) -> anyhow::Result<()> {
83 let test_case = test_case.into();
83 let test_case = test_case.into();
84− let mut app =
84+ let mut app = match app {
85− app.unwrap_or_else(|| Application::new(Args::default(), Config::default()).unwrap());
86+ None => Application::new(Args::default(), Config::default())?,
87 let (view, doc) = helix_view::current!(app.editor);
89 let (view, doc) = helix_view::current!(app.editor);
88 let sel = doc.selection(view.id).clone();
90 let sel = doc.selection(view.id).clone();
@@ -108,7 +110,7 @@ pub async fn test_key_sequence_text_result<T: Into<TestCase>>(
108 test_case: T,
110 test_case: T,
109) -> anyhow::Result<()> {
111) -> anyhow::Result<()> {
110 let test_case = test_case.into();
112 let test_case = test_case.into();
111− let app = Application::new(args, config).unwrap();
113+ let app = Application::new(args, config)?;
113 test_key_sequence_with_input_text(Some(app), test_case.clone(), &|app| {
115 test_key_sequence_with_input_text(Some(app), test_case.clone(), &|app| {
114 let doc = doc!(app.editor);
116 let doc = doc!(app.editor);
@@ -123,13 +125,16 @@ pub async fn test_key_sequence_text_result<T: Into<TestCase>>(
126−pub fn temp_file_with_contents<S: AsRef<str>>(content: S) -> tempfile::NamedTempFile {
128+pub fn temp_file_with_contents<S: AsRef<str>>(
130+) -> anyhow::Result<tempfile::NamedTempFile> {
127− let mut temp_file = tempfile::NamedTempFile::new().unwrap();
131+ let mut temp_file = tempfile::NamedTempFile::new()?;
128 temp_file
133 temp_file
129 .as_file_mut()
134 .as_file_mut()
130− .write_all(content.as_ref().as_bytes())
135+ .write_all(content.as_ref().as_bytes())?;
132− temp_file.flush().unwrap();
137+ temp_file.flush()?;
133− temp_file.as_file_mut().sync_all().unwrap();
138+ temp_file.as_file_mut().sync_all()?;
134− temp_file
139+ Ok(temp_file)