Hygiene B6b: convert leaky-world tests + HudSystem cosmetics

- 10 EditMode files: every bare trailing world.Dispose() now inside using(world){} (single-world) or a [TearDown]+List<World> (the multi-world reject-matrix tests in BoonApplyTests/RouteSelectSystemTests) — an assertion failure can no longer leak the World and mask the true first failure. No test logic changed.
- HudSystem: collapse the blank-line run before the class close; trim the extracted route-map clause from the READY-panel comment.

466/466 EditMode tests pass.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-07-08 21:06:33 -07:00
parent 6379f5d897
commit e27a495530
11 changed files with 128 additions and 62 deletions
@@ -84,6 +84,8 @@ namespace ProjectM.Tests
public void Purchase_BumpsTier_Withdraws_UpsertsAllClassMembers_FlagsSave()
{
var (world, group) = MakeWorld();
using (world)
{
var em = world.EntityManager;
var dir = MakeDirector(em, RunLifecycle.Staging, 25);
var warriorA = MakePlayer(em, 1, ClassTraits.WarriorClass);
@@ -104,13 +106,15 @@ namespace ProjectM.Tests
Assert.AreEqual(0, rowsR);
Assert.AreEqual(1, em.GetComponentData<SaveRequest>(dir).Pending, "purchase flags the autosave");
Assert.AreEqual(0, PendingRequests(em), "request consumed");
world.Dispose();
}
}
[Test]
public void TwoSameTick_BarelyEnough_ExactlyOneSucceeds()
{
var (world, group) = MakeWorld();
using (world)
{
var em = world.EntityManager;
var dir = MakeDirector(em, RunLifecycle.Staging, 10); // ids 1 and 4 BOTH cost 10 at tier 0
var warrior = MakePlayer(em, 1, ClassTraits.WarriorClass);
@@ -126,13 +130,15 @@ namespace ProjectM.Tests
Assert.AreEqual(0, StorageMath.TotalOf(em.GetBuffer<StorageEntry>(dir, true), ResourceId.Aether),
"the single cost fully drained the ledger — and never went negative (TotalOf pre-check)");
Assert.AreEqual(0, PendingRequests(em), "both requests consumed");
world.Dispose();
}
}
[Test]
public void SecondPurchase_AbsoluteUpsert_SingleRow_RampedCost()
{
var (world, group) = MakeWorld();
using (world)
{
var em = world.EntityManager;
var dir = MakeDirector(em, RunLifecycle.Staging, 30); // tier1 = 10, tier2 = 10 + 1*5 = 15
var warrior = MakePlayer(em, 1, ClassTraits.WarriorClass);
@@ -150,13 +156,15 @@ namespace ProjectM.Tests
Assert.AreEqual(1, rows, "one modifier row — an incremental append would double-count in recompute");
Assert.AreEqual(5, StorageMath.TotalOf(em.GetBuffer<StorageEntry>(dir, true), ResourceId.Aether),
"linear ramp: 30 - 10 - 15");
world.Dispose();
}
}
[Test]
public void Rejects_WrongClassMask_MaxTierCap_NonStaging()
{
var (world, group) = MakeWorld();
using (world)
{
var em = world.EntityManager;
var dir = MakeDirector(em, RunLifecycle.Staging, 999);
var warrior = MakePlayer(em, 1, ClassTraits.WarriorClass);
@@ -184,7 +192,7 @@ namespace ProjectM.Tests
"non-Staging purchase dropped");
Assert.AreEqual(999, StorageMath.TotalOf(em.GetBuffer<StorageEntry>(dir, true), ResourceId.Aether));
Assert.AreEqual(0, PendingRequests(em), "every request consumed, accepted or not");
world.Dispose();
}
}
}
}