mirror of
https://github.com/storytold/craft-anything.git
synced 2026-11-05 20:47:45 +01:00
The pasted-picture test passes when its pastes share a millisecond (#761)
The pasted-picture test accepts a third paste that lands in the same millisecond as the first and takes its freed name, and checks the first paste's content is gone. Test only.
This commit is contained in:
@@ -1281,7 +1281,9 @@ mod tests {
|
||||
std::fs::File::options().write(true).open(f).unwrap().set_modified(old).unwrap();
|
||||
}
|
||||
let third = save_pasted_picture(dir.path(), 2, 1, vec![0; 8], std::slice::from_ref(&second)).unwrap();
|
||||
assert!(!p.exists() && second.exists() && third.exists());
|
||||
// In the same millisecond as the first, the third takes the name its removal freed.
|
||||
assert!((third == p || !p.exists()) && second.exists() && third.exists());
|
||||
assert_ne!(std::fs::read(&third).ok(), Some(bytes), "the first paste is gone");
|
||||
let mut names: Vec<_> = std::fs::read_dir(dir.path()).unwrap().flatten().map(|e| e.file_name()).collect();
|
||||
names.sort();
|
||||
assert_eq!(names.len(), 2, "no temp files left behind: {names:?}");
|
||||
|
||||
Reference in New Issue
Block a user