From e98681d6685cb029b542ef4cc3c7c6a1edacb112 Mon Sep 17 00:00:00 2001 From: Jannis Date: Tue, 13 Aug 2024 22:51:17 +0000 Subject: [PATCH 1/6] Update BfCompiler.cpp Added a check for a Name property --- IDEHelper/Compiler/BfCompiler.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/IDEHelper/Compiler/BfCompiler.cpp b/IDEHelper/Compiler/BfCompiler.cpp index 7bb4e946..1c0df3d1 100644 --- a/IDEHelper/Compiler/BfCompiler.cpp +++ b/IDEHelper/Compiler/BfCompiler.cpp @@ -961,6 +961,10 @@ void BfCompiler::EmitTestMethod(BfVDataModule* bfModule, Array& test { testMethod.mName += "Ig"; } + else if (fieldDef->mName == "Name") + { + testMethod.mName += "Ovwn"; + } } } From 288eb9eaad88b490534f4f76ee5461721ad33a9c Mon Sep 17 00:00:00 2001 From: Jannis Date: Wed, 14 Aug 2024 09:00:53 +0000 Subject: [PATCH 2/6] Update BfCompiler.cpp Added name attribute --- IDEHelper/Compiler/BfCompiler.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/IDEHelper/Compiler/BfCompiler.cpp b/IDEHelper/Compiler/BfCompiler.cpp index 1c0df3d1..151484bb 100644 --- a/IDEHelper/Compiler/BfCompiler.cpp +++ b/IDEHelper/Compiler/BfCompiler.cpp @@ -961,9 +961,21 @@ void BfCompiler::EmitTestMethod(BfVDataModule* bfModule, Array& test { testMethod.mName += "Ig"; } - else if (fieldDef->mName == "Name") + } + else if ((constant != NULL) && (constant->mTypeCode == BfTypeCode_StringId)) + { + BfFieldDef* fieldDef = field.mFieldRef; + if (fieldDef->mName == "Name") { - testMethod.mName += "Ovwn"; + String* str = bfModule->GetStringPoolString(field.mParam.mValue, typeInstance->mConstHolder); + testMethod.mName += "Name"; + String* temp = new String(*str); + temp->Replace('\t', "\\t"); //Good enough for now + temp->Replace('\n', "\\n"); + temp->Replace('\a', "\\a"); + temp->Replace('\v', "\\v"); + testMethod.mName += *temp; + testMethod.mName += "\a"; } } } From a1651959a1c091d4a4a6e5ffd85990bbdd09fa1c Mon Sep 17 00:00:00 2001 From: Jannis Date: Wed, 14 Aug 2024 09:01:44 +0000 Subject: [PATCH 3/6] Update Attribute.bf added name field to test attribute --- BeefLibs/corlib/src/Attribute.bf | 1 + 1 file changed, 1 insertion(+) diff --git a/BeefLibs/corlib/src/Attribute.bf b/BeefLibs/corlib/src/Attribute.bf index bc6b8a09..ad27c2c2 100644 --- a/BeefLibs/corlib/src/Attribute.bf +++ b/BeefLibs/corlib/src/Attribute.bf @@ -457,6 +457,7 @@ namespace System public bool Ignore; public bool Profile; public String Tag; + public String Name; } public struct ImportAttribute : Attribute From 1f6e15bef7ae3a4ae7255be94525b61dd32463d2 Mon Sep 17 00:00:00 2001 From: Jannis Date: Wed, 14 Aug 2024 09:03:47 +0000 Subject: [PATCH 4/6] Update TestManager.bf actually use and resolve Name attribute --- IDE/src/TestManager.bf | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/IDE/src/TestManager.bf b/IDE/src/TestManager.bf index c2d4cd2c..74502faf 100644 --- a/IDE/src/TestManager.bf +++ b/IDE/src/TestManager.bf @@ -388,10 +388,25 @@ namespace IDE testEntry.mLine = int32.Parse(cmdParts[3]).Get(); testEntry.mColumn = int32.Parse(cmdParts[4]).Get(); - testEntry.mShouldFail = attribs.Contains("Sf"); - testEntry.mProfile = attribs.Contains("Pr"); - testEntry.mIgnore = attribs.Contains("Ig"); + List attributes = scope .(attribs.Split('\a')); + for(var i in attributes) + { + if(i.StartsWith('\v')) + { + if(i == "\vSf") + testEntry.mShouldFail = true; + else if(i == "\vPr") + testEntry.mProfile = true; + else if(i == "\vIg") + testEntry.mIgnore = true; + } + else if(i.StartsWith("Name")) + { + testEntry.mName.Clear(); + scope String(i.Substring("Name".Length)).Escape(testEntry.mName); + } + } testInstance.mTestEntries.Add(testEntry); } } From aa4287ed55a93a54b28e1f013d0b8ee9bdad5462 Mon Sep 17 00:00:00 2001 From: Jannis Date: Wed, 14 Aug 2024 09:11:29 +0000 Subject: [PATCH 5/6] Bugfix --- IDE/src/TestManager.bf | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/IDE/src/TestManager.bf b/IDE/src/TestManager.bf index 74502faf..8252463b 100644 --- a/IDE/src/TestManager.bf +++ b/IDE/src/TestManager.bf @@ -394,11 +394,11 @@ namespace IDE { if(i.StartsWith('\v')) { - if(i == "\vSf") + if(i == "Sf") testEntry.mShouldFail = true; - else if(i == "\vPr") + else if(i == "Pr") testEntry.mProfile = true; - else if(i == "\vIg") + else if(i == "Ig") testEntry.mIgnore = true; } else if(i.StartsWith("Name")) From 5c6866d078d9831f652a64d1dc3f8e511531a8ed Mon Sep 17 00:00:00 2001 From: Jannis Date: Wed, 14 Aug 2024 09:35:57 +0000 Subject: [PATCH 6/6] Further bugfix --- IDEHelper/Compiler/BfCompiler.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/IDEHelper/Compiler/BfCompiler.cpp b/IDEHelper/Compiler/BfCompiler.cpp index 151484bb..e7625aa9 100644 --- a/IDEHelper/Compiler/BfCompiler.cpp +++ b/IDEHelper/Compiler/BfCompiler.cpp @@ -951,15 +951,15 @@ void BfCompiler::EmitTestMethod(BfVDataModule* bfModule, Array& test BfFieldDef* fieldDef = field.mFieldRef; if (fieldDef->mName == "ShouldFail") { - testMethod.mName += "Sf"; + testMethod.mName += "Sf\a"; } else if (fieldDef->mName == "Profile") { - testMethod.mName += "Pr"; + testMethod.mName += "Pr\a"; } else if (fieldDef->mName == "Ignore") { - testMethod.mName += "Ig"; + testMethod.mName += "Ig\a"; } } else if ((constant != NULL) && (constant->mTypeCode == BfTypeCode_StringId))