SlotReadOnlyTests: restore the Explained assertion lost with a debug line; an unheld key a store lists foreign is not writable
The assertion went out with 0dfc437b. The new test kills mutant M13 (the unheld branch answering
true), which survived without it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
90f1b6b59a
commit
f3b62a7ee7
1 changed files with 16 additions and 0 deletions
|
|
@ -313,6 +313,7 @@ namespace GameCult.Caching.Tests
|
|||
reader.AddBackingStore(Store());
|
||||
var unread = Stored(reader, Marked).UnreadSlots;
|
||||
Assert.That(unread, Is.Not.Null, "the store kind decodes through the marking path");
|
||||
Assert.That(unread!.Explained, Is.True, "depth 0 and reported by the catalog comparison");
|
||||
Assert.That(unread.TypeName, Is.EqualTo(nameof(NarrowDoc)));
|
||||
Assert.That(unread.SlotCount, Is.EqualTo(3));
|
||||
Assert.That(unread.DeclaredCount, Is.EqualTo(2));
|
||||
|
|
@ -580,6 +581,21 @@ namespace GameCult.Caching.Tests
|
|||
Assert.That(refusal.Message, Does.Contain("read-only backing store"));
|
||||
}
|
||||
|
||||
// A key the cache does not hold, but a store carries as a foreign record: the store's removal check refuses it.
|
||||
[Test]
|
||||
public void IsWritableIsFalseForAnUnheldKeyAStoreListsForeign()
|
||||
{
|
||||
var path = Path.Combine(_directory, "foreign.cc");
|
||||
using (var writer = Open(path, GapRegistry))
|
||||
Assert.That(writer.Commit(batch => batch.Upsert(new GapDoc { Name = "g" }, new CultRecordHandle<GapDoc>(Marked))), Is.True);
|
||||
|
||||
using var cache = Open(path, SurfaceRegistry);
|
||||
Assert.That(cache.GetStored(Marked), Is.Null, "the cache does not hold a record no registered type reads");
|
||||
Assert.That(cache.IsWritable(Marked), Is.False);
|
||||
AssertWriteAgrees(cache, Marked, () => cache.Commit(batch => batch.Remove(Marked)));
|
||||
Assert.That(cache.IsWritable(Unheld), Is.True);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void IsWritableIsFalseForARecordNoAttachedStoreIsHomeTo()
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue