1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-08 19:48:20 +02:00

Make test methods from extensions work (including static blocks)

This commit is contained in:
Brian Fiete 2021-12-28 08:45:28 -05:00
parent 7c03f5e2cd
commit 15a2cdfeed

View file

@ -827,7 +827,7 @@ void BfCompiler::GetTestMethods(BfVDataModule* bfModule, Array<TestMethod>& test
auto _CheckMethod = [&](BfTypeInstance* typeInstance, BfMethodInstance* methodInstance)
{
auto project = typeInstance->mTypeDef->mProject;
auto project = methodInstance->mMethodDef->mDeclaringType->mProject;
if (project->mTargetType != BfTargetType_BeefTest)
return;
if (project != bfModule->mProject)
@ -897,6 +897,16 @@ void BfCompiler::GetTestMethods(BfVDataModule* bfModule, Array<TestMethod>& test
if (typeInstance == NULL)
continue;
if (typeInstance->mTypeDef->IsGlobalsContainer())
{
NOP;
}
if (typeInstance->mTypeDef->mProject->mName == "BeefTest")
{
NOP;
}
if (typeInstance->IsUnspecializedType())
continue;
@ -915,6 +925,7 @@ void BfCompiler::EmitTestMethod(BfVDataModule* bfModule, Array<TestMethod>& test
auto methodInstance = testMethod.mMethodInstance;
auto typeInstance = methodInstance->GetOwner();
testMethod.mName += bfModule->TypeToString(typeInstance);
if (!testMethod.mName.IsEmpty())
testMethod.mName += ".";
testMethod.mName += methodInstance->mMethodDef->mName;