@@ -75,10 +75,12 @@ async fn test_write_concurrent() -> anyhow::Result<()> {
76#[tokio::test]
76#[tokio::test]
77async fn test_write_fail_mod_flag() -> anyhow::Result<()> {
77async fn test_write_fail_mod_flag() -> anyhow::Result<()> {
78+ let file = helpers::new_readonly_tempfile()?;
78 test_key_sequences(
80 test_key_sequences(
79 &mut Application::new(
81 &mut Application::new(
81− files: vec![(PathBuf::from("/foo"), Position::default())],
83+ files: vec![(file.path().to_path_buf(), Position::default())],
82 ..Default::default()
84 ..Default::default()
84 Config::default(),
86 Config::default(),
@@ -116,6 +118,8 @@ async fn test_write_fail_mod_flag() -> anyhow::Result<()> {
117#[tokio::test]
119#[tokio::test]
118async fn test_write_fail_new_path() -> anyhow::Result<()> {
120async fn test_write_fail_new_path() -> anyhow::Result<()> {
121+ let file = helpers::new_readonly_tempfile()?;
119 test_key_sequences(
123 test_key_sequences(
120 &mut Application::new(Args::default(), Config::default())?,
124 &mut Application::new(Args::default(), Config::default())?,
@@ -123,15 +127,21 @@ async fn test_write_fail_new_path() -> anyhow::Result<()> {
124 Some(&|app| {
128 Some(&|app| {
125 let doc = doc!(app.editor);
129 let doc = doc!(app.editor);
131+ Some(&Severity::Error),
126− assert_eq!(None, app.editor.get_status());
132+ app.editor.get_status().map(|status| status.1)
127 assert_eq!(None, doc.path());
134 assert_eq!(None, doc.path());
131− Some(":w /foo<ret>"),
138+ Some(&format!(":w {}<ret>", file.path().to_string_lossy())),
132 Some(&|app| {
139 Some(&|app| {
133 let doc = doc!(app.editor);
140 let doc = doc!(app.editor);
142+ Some(&Severity::Error),
134− assert_eq!(&Severity::Error, app.editor.get_status().unwrap().1);
143+ app.editor.get_status().map(|status| status.1)
135 assert_eq!(None, doc.path());
145 assert_eq!(None, doc.path());