CultLib/tests/vectors/document-variants-c2a/old-reader-probes/OldReaderV3Probe.cs
Meta Vens f4f8e3ed93 Old-reader probes: a reader from before element ids refuses the v3 header
old-reader-refusal.sh stages the C0 merge (e382bb4, or OLD_READER_REV) plus the v3 vector
and one probe per runtime onto a commit; the probe run from that tree is the old reader.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-29 18:27:17 +02:00

34 lines
1.3 KiB
C#

#nullable enable
using System;
using System.IO;
using GameCult.Caching;
using GameCult.Caching.MessagePack;
using NUnit.Framework;
namespace GameCult.Caching.Tests
{
// Copied into a checkout of the C0 merge (e382bb4) by old-reader-refusal.sh. Not part of this tree's suite.
public class OldReaderV3Probe
{
[Test]
public void ACopyOfV3BaseIsRefusedByHeader()
{
var root = Path.Combine(Path.GetTempPath(), $"cultlib-oldreader-{Guid.NewGuid():N}");
Directory.CreateDirectory(root);
try
{
var file = Path.Combine(root, "store.msgpack");
File.Copy(Path.Combine(Environment.GetEnvironmentVariable("CULTLIB_ROOT")!, "tests", "vectors", "document-variants-c2a", "v3-base.msgpack"), file);
using var cache = new CultCache();
var error = Assert.Catch(() => cache.AddBackingStore(new SingleFileMessagePackBackingStore(file)));
Assert.That(error, Is.Not.Null);
TestContext.Out.WriteLine("OLD-READER csharp refused: " + error!.Message);
Assert.That(error.ToString(), Does.Contain("cultcache.store.v3"));
}
finally
{
Directory.Delete(root, recursive: true);
}
}
}
}