mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-22 21:41:37 +00:00
fix: tighten stress_rename_operations assertion to check relevant paths
Bugbot flagged `has_create || has_remove || !events.is_empty()` as trivially true. Replace with a check that at least one event references either the original or renamed path, regardless of event type (FSEvents on macOS reports renames as Write/Metadata, not always Create/Remove).
This commit is contained in:
parent
22808e6140
commit
361b4a30ec
1 changed files with 10 additions and 9 deletions
|
|
@ -866,17 +866,18 @@ mod tests {
|
|||
// Should get either:
|
||||
// - Remove(original) + Create(renamed) for RenameMode::Both
|
||||
// - Or separate From/To events
|
||||
let has_remove = events
|
||||
.iter()
|
||||
.any(|e| matches!(e, VfsEvent::Remove(p) if p == &original));
|
||||
let has_create = events
|
||||
.iter()
|
||||
.any(|e| matches!(e, VfsEvent::Create(p) if p == &renamed));
|
||||
// FSEvents on macOS may report renames as Write/Metadata events rather
|
||||
// than the specific Create/Remove pair. Verify that at least one event
|
||||
// references either the original or renamed path.
|
||||
let has_relevant_event = events.iter().any(|e| match e {
|
||||
VfsEvent::Create(p) | VfsEvent::Write(p) | VfsEvent::Remove(p) => {
|
||||
p == &original || p == &renamed
|
||||
}
|
||||
});
|
||||
|
||||
// At minimum we should see the new file appear
|
||||
assert!(
|
||||
has_create || has_remove || !events.is_empty(),
|
||||
"Expected rename to generate events (got {} events: {:?})",
|
||||
has_relevant_event,
|
||||
"Expected rename to generate events for original or renamed path (got {} events: {:?})",
|
||||
events.len(),
|
||||
events
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue