From 841b11db948a31bff9171edafd020f11d68752a1 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Sat, 17 Oct 2026 19:44:10 +0200 Subject: [PATCH] CultMathJson tests: unknown names are skipped under case-insensitive reading Kills the surviving Stryker mutant in Fields.IndexOf's case-insensitive loop and covers its not-found return. Co-Authored-By: Claude Opus 5.5 --- tests/GameCult.Caching.Tests/CultMathJsonTests.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/GameCult.Caching.Tests/CultMathJsonTests.cs b/tests/GameCult.Caching.Tests/CultMathJsonTests.cs index ef8ea3d6..54e01e24 100644 --- a/tests/GameCult.Caching.Tests/CultMathJsonTests.cs +++ b/tests/GameCult.Caching.Tests/CultMathJsonTests.cs @@ -131,6 +131,14 @@ namespace GameCult.Caching.Tests Parse("""{"cos":{"x":1,"y":9},"cosine":{"x":2}}""").cosine.Should().Be(new float4(2f, 0f, 0f, 0f)); } + [Test] + public void Reading_SkipsUnknownNamesWhenCaseInsensitive() + { + var options = new JsonSerializerOptions { PropertyNameCaseInsensitive = true }.AddCultMathConverters(); + JsonSerializer.Deserialize("""{"extra":[1,2],"COSINE":{"x":3},"coss":{"x":4}}""", options).cosine.x.Should().Be(3f); + JsonSerializer.Deserialize("""{"X":1,"q":2,"Y":3}""", options).Should().Be(new float2(1f, 3f)); + } + [Test] public void Writing_NeverEmitsLegacyNames() {