fix(testing): rename global GRegistry to GTestRegistry to avoid symbol clash

The test framework's `GRegistry: TList<TTestCaseClass>` collided with
`GRegistry: TTargetRegistry` in blaise.codegen.toolkit.  The compiler emits
unit-level globals under their bare name with export (strong) linkage, so both
`GRegistry` symbols resolved to one shared 8-byte slot.  When the test runner
links both units, the test framework and the codegen toolkit alias the same
storage and free/read it as the wrong type at teardown.

Rename the test-framework global to GTestRegistry — a unit-specific name that
collides with nothing else — so the two registries occupy distinct storage.
This commit is contained in:
Graeme Geldenhuys 2026-06-30 01:44:28 +01:00
parent 93596d135c
commit b5f8800817

View file

@ -205,7 +205,7 @@ implementation
----------------------------------------------------------------------- }
var
GRegistry: TList<TTestCaseClass>; { registered test-case classes }
GTestRegistry: TList<TTestCaseClass>; { registered test-case classes }
{ -----------------------------------------------------------------------
TTest
@ -655,22 +655,22 @@ end;
procedure RegisterTest(ATestClass: TTestCaseClass);
begin
if GRegistry = nil then
GRegistry := TList<TTestCaseClass>.Create();
GRegistry.Add(ATestClass);
if GTestRegistry = nil then
GTestRegistry := TList<TTestCaseClass>.Create();
GTestRegistry.Add(ATestClass);
end;
function GetRegisteredTestCount: Integer;
begin
if GRegistry = nil then
if GTestRegistry = nil then
Result := 0
else
Result := GRegistry.Count;
Result := GTestRegistry.Count;
end;
function GetRegisteredTest(AIndex: Integer): TTestCaseClass;
begin
Result := GRegistry.Get(AIndex);
Result := GTestRegistry.Get(AIndex);
end;
end.