@@ -75,10 +75,12 @@ async fn test_write_concurrent() -> anyhow::Result<()> {
7575
7676#[tokio::test]
7777async fn test_write_fail_mod_flag() -> anyhow::Result<()> {
78+ let file = helpers::new_readonly_tempfile()?;
79+
7880 test_key_sequences(
7981 &mut Application::new(
8082 Args {
81− files: vec![(PathBuf::from("/foo"), Position::default())],
83+ files: vec![(file.path().to_path_buf(), Position::default())],
8284 ..Default::default()
8385 },
8486 Config::default(),
@@ -116,6 +118,8 @@ async fn test_write_fail_mod_flag() -> anyhow::Result<()> {
116118
117119#[tokio::test]
118120async fn test_write_fail_new_path() -> anyhow::Result<()> {
121+ let file = helpers::new_readonly_tempfile()?;
122+
119123 test_key_sequences(
120124 &mut Application::new(Args::default(), Config::default())?,
121125 vec![
@@ -123,15 +127,21 @@ async fn test_write_fail_new_path() -> anyhow::Result<()> {
123127 None,
124128 Some(&|app| {
125129 let doc = doc!(app.editor);
126− assert_eq!(None, app.editor.get_status());
130+ assert_ne!(
131+ Some(&Severity::Error),
132+ app.editor.get_status().map(|status| status.1)
133+ );
127134 assert_eq!(None, doc.path());
128135 }),
129136 ),
130137 (
131− Some(":w /foo<ret>"),
138+ Some(&format!(":w {}<ret>", file.path().to_string_lossy())),
132139 Some(&|app| {
133140 let doc = doc!(app.editor);
134− assert_eq!(&Severity::Error, app.editor.get_status().unwrap().1);
141+ assert_eq!(
142+ Some(&Severity::Error),
143+ app.editor.get_status().map(|status| status.1)
144+ );
135145 assert_eq!(None, doc.path());
136146 }),
137147 ),