Skip to content

Commit

Permalink
Fix flaky format tests
Browse files Browse the repository at this point in the history
Two tests writing to the same file when they can be run concurrently invites
race conditions.
  • Loading branch information
jmacdonald committed Oct 16, 2024
1 parent 0658390 commit e7f9c83
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/commands/buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1529,7 +1529,7 @@ mod tests {
app.preferences.replace(preferences);

// Create a temp file with content and open it.
let path = format!("{}/format_tool.rs", env::temp_dir().display());
let path = format!("{}/no_format_by_default.rs", env::temp_dir().display());
let mut temp_file = File::create(&path).unwrap();
write!(temp_file, "amp editor\n").unwrap();
app.workspace.open_buffer(&Path::new(&path)).unwrap();
Expand Down Expand Up @@ -1562,7 +1562,7 @@ mod tests {
app.preferences.replace(preferences);

// Create a temp file with content and open it.
let path = format!("{}/format_tool.rs", env::temp_dir().display());
let path = format!("{}/format_when_configured.rs", env::temp_dir().display());
let mut temp_file = File::create(&path).unwrap();
write!(temp_file, "amp editor\n").unwrap();
app.workspace.open_buffer(&Path::new(&path)).unwrap();
Expand Down

0 comments on commit e7f9c83

Please sign in to comment.