simulateFinalizerForTest method
Test seam matching the production Finalizer callback path.
Locates the registration whose target is identical to resource
under name, then dispatches _recordRelease(token) against its
token. Deterministically simulates GC reclamation without
depending on VM finalization timing.
Implementation
@visibleForTesting
void simulateFinalizerForTest(String name, Object resource) {
final bucket = _buckets[name];
if (bucket == null) return;
for (final r in bucket.refs) {
if (identical(r.ref.target, resource)) {
_recordRelease(r.token);
return;
}
}
}