@@ -81,8 +81,10 @@ pub async fn test_key_sequence_with_input_text<T: Into<TestCase>>(
8181 test_fn: &dyn Fn(&Application),
8282) -> anyhow::Result<()> {
8383 let test_case = test_case.into();
84− let mut app =
85− app.unwrap_or_else(|| Application::new(Args::default(), Config::default()).unwrap());
84+ let mut app = match app {
85+ Some(app) => app,
86+ None => Application::new(Args::default(), Config::default())?,
87+ };
8688
8789 let (view, doc) = helix_view::current!(app.editor);
8890 let sel = doc.selection(view.id).clone();
@@ -108,7 +110,7 @@ pub async fn test_key_sequence_text_result<T: Into<TestCase>>(
108110 test_case: T,
109111) -> anyhow::Result<()> {
110112 let test_case = test_case.into();
111− let app = Application::new(args, config).unwrap();
113+ let app = Application::new(args, config)?;
112114
113115 test_key_sequence_with_input_text(Some(app), test_case.clone(), &|app| {
114116 let doc = doc!(app.editor);
@@ -123,13 +125,16 @@ pub async fn test_key_sequence_text_result<T: Into<TestCase>>(
123125 .await
124126}
125127
126−pub fn temp_file_with_contents<S: AsRef<str>>(content: S) -> tempfile::NamedTempFile {
127− let mut temp_file = tempfile::NamedTempFile::new().unwrap();
128+pub fn temp_file_with_contents<S: AsRef<str>>(
129+ content: S,
130+) -> anyhow::Result<tempfile::NamedTempFile> {
131+ let mut temp_file = tempfile::NamedTempFile::new()?;
132+
128133 temp_file
129134 .as_file_mut()
130− .write_all(content.as_ref().as_bytes())
131− .unwrap();
132− temp_file.flush().unwrap();
133− temp_file.as_file_mut().sync_all().unwrap();
134− temp_file
135+ .write_all(content.as_ref().as_bytes())?;
136+
137+ temp_file.flush()?;
138+ temp_file.as_file_mut().sync_all()?;
139+ Ok(temp_file)
135140}