mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-10-24 09:46:59 -06:00
Tests: the data set export test fails when its folder cannot be emptied (#3389)
variables_panel_data_sets_ask_off_the_ui_thread empties its folder before Export Data Sets… writes out.csv, then checks that the file is exactly the header and the row for data set B. It ignored the result of remove_dir_all, and create_dir_all succeeds on a folder that is still there. When the folder could not be emptied, an out.csv left by an earlier run passed the check even when the export wrote nothing. The test now fails when emptying the folder fails with an error other than NotFound.
This commit is contained in:
@@ -229,7 +229,9 @@ fn variables_panel_data_sets_ask_off_the_ui_thread() {
|
||||
let (mut app, shown, _) = app();
|
||||
app.run("file.new", json!({"width": 100, "height": 80})).unwrap();
|
||||
let dir = vectorcraft_testkit::temp_dir("picks-data-sets");
|
||||
let _ = std::fs::remove_dir_all(&dir);
|
||||
if let Err(e) = std::fs::remove_dir_all(&dir) {
|
||||
assert_eq!(e.kind(), std::io::ErrorKind::NotFound, "cannot empty {}: {e}", dir.display());
|
||||
}
|
||||
std::fs::create_dir_all(&dir).unwrap();
|
||||
let (csv, out) = (dir.join("sets.csv"), dir.join("out.csv"));
|
||||
std::fs::write(&csv, "name,Name\nB,y\n").unwrap();
|
||||
|
||||
Reference in New Issue
Block a user