cultcache C# tests: pin that a refusal orders keys by code unit, not case

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Libby 2026-11-11 09:03:39 +00:00
commit 8973efdd0b

View file

@ -562,5 +562,21 @@ namespace GameCult.Caching.Tests
Assert.That(walked, Is.EqualTo(13));
}
// Not a vector row (the cross-runtime rows are fixed by the spec): keys order by code unit, so "B" precedes "a".
[Test]
public void RefusalOrdersKeysByCodeUnitNotByCase()
{
using var cache = CultCacheMessagePack.Create(
Path.Combine(Path.GetTempPath(), $"cultlib-uidxc-{Guid.NewGuid():N}.cc"),
new CultCacheOpenOptions { Registry = CultDocumentRegistry.ForTypes(new[] { ItemIndex }) });
var refused = Assert.Throws<InvalidOperationException>(() => cache.Commit(batch =>
{
foreach (var (key, sku) in new[] { ("a", "S"), ("z", "S"), ("B", "T"), ("C", "T") })
batch.Upsert(ItemIndex, EmittedDocumentTypes.New(ItemIndex, ("Sku", sku), ("Category", "")), new CultRecordKey(key));
}))!;
Assert.That(refused.Message, Is.EqualTo(
"Records B and C (tests.unique_item) both hold unique index 'Sku'; an index value names one record."));
}
}
}