C# tests: a default ImmutableArray in a contract list is refused
All checks were successful
Portable Eve contracts and browser lowering / ubuntu-latest eve-browser-lowering (pull_request) Successful in 1m45s
Portable Eve contracts and browser lowering / ubuntu-latest eve-contracts (pull_request) Successful in 2m40s

This commit is contained in:
Meta Vens 2026-11-28 01:47:42 +01:00
commit e27e6170ac

View file

@ -106,6 +106,11 @@ public sealed class ReadOnlyListTests
args[index] = null;
var list = Assert.Throws<ThingDomainException>(() => door.Call(args), $"{door.Name}: nil list")!;
Assert.That(list.Bound, Is.EqualTo("present"), door.Name);
// What a nil list decodes to: a default (uninitialised) ImmutableArray, which throws on first use.
args[index] = Activator.CreateInstance(typeof(System.Collections.Immutable.ImmutableArray<>).MakeGenericType(element));
var uninitialised = Assert.Throws<ThingDomainException>(() => door.Call(args), $"{door.Name}: default array")!;
Assert.That(uninitialised.Bound, Is.EqualTo("present"), door.Name);
}
}