Test retain filter placement, source set divergence, and excluding keying

This commit is contained in:
Dennis Kobert
2026-07-31 10:18:00 +00:00
parent c925f4ec39
commit d9c8532e71
2 changed files with 128 additions and 0 deletions

View File

@@ -1434,6 +1434,21 @@ mod context_impl_tests {
assert_ne!(hash_with(&initial), hash_with(&bumped_retained), "retained source bumps must invalidate");
}
#[test]
fn excluding_keys_ignore_own_source_bumps() {
let arena = Arena::new(64);
let initial = [(7, 1), (9, 5)];
let own_bumped = [(7, 2), (9, 5)];
let other_bumped = [(7, 1), (9, 6)];
let hash_with = |generations: &[(SourceId, u64)]| {
let scope = scope_fixture(generations, &arena).excluding(7);
hash_of(&ContextImpl::root(&scope))
};
assert_eq!(hash_with(&initial), hash_with(&own_bumped), "a source's own generation bump must not change its slot key");
assert_ne!(hash_with(&initial), hash_with(&other_bumped), "bumps of other sources must change the slot key");
}
#[test]
fn unretained_scope_sees_every_bump() {
let arena = Arena::new(64);