From 15a2cdfeedb2577354986b8401796ece3a6f4643 Mon Sep 17 00:00:00 2001 From: Brian Fiete Date: Tue, 28 Dec 2021 08:45:28 -0500 Subject: [PATCH] Make test methods from extensions work (including static blocks) --- IDEHelper/Compiler/BfCompiler.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/IDEHelper/Compiler/BfCompiler.cpp b/IDEHelper/Compiler/BfCompiler.cpp index 9e2138b0..20c184c5 100644 --- a/IDEHelper/Compiler/BfCompiler.cpp +++ b/IDEHelper/Compiler/BfCompiler.cpp @@ -827,7 +827,7 @@ void BfCompiler::GetTestMethods(BfVDataModule* bfModule, Array& 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& test if (typeInstance == NULL) continue; + if (typeInstance->mTypeDef->IsGlobalsContainer()) + { + NOP; + } + + if (typeInstance->mTypeDef->mProject->mName == "BeefTest") + { + NOP; + } + if (typeInstance->IsUnspecializedType()) continue; @@ -915,7 +925,8 @@ void BfCompiler::EmitTestMethod(BfVDataModule* bfModule, Array& test auto methodInstance = testMethod.mMethodInstance; auto typeInstance = methodInstance->GetOwner(); testMethod.mName += bfModule->TypeToString(typeInstance); - testMethod.mName += "."; + if (!testMethod.mName.IsEmpty()) + testMethod.mName += "."; testMethod.mName += methodInstance->mMethodDef->mName; testMethod.mName += "\t";