mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-24 18:48:01 +02:00
Merge pull request #2008 from Booklordofthedings/master
[Enhancement] Name field for test attributes
This commit is contained in:
commit
c3b8fdf794
3 changed files with 38 additions and 6 deletions
|
@ -457,6 +457,7 @@ namespace System
|
|||
public bool Ignore;
|
||||
public bool Profile;
|
||||
public String Tag;
|
||||
public String Name;
|
||||
}
|
||||
|
||||
public struct ImportAttribute : Attribute
|
||||
|
|
|
@ -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<StringView> attributes = scope .(attribs.Split('\a'));
|
||||
for(var i in attributes)
|
||||
{
|
||||
if(i.StartsWith('\v'))
|
||||
{
|
||||
if(i == "Sf")
|
||||
testEntry.mShouldFail = true;
|
||||
else if(i == "Pr")
|
||||
testEntry.mProfile = true;
|
||||
else if(i == "Ig")
|
||||
testEntry.mIgnore = true;
|
||||
}
|
||||
else if(i.StartsWith("Name"))
|
||||
{
|
||||
testEntry.mName.Clear();
|
||||
scope String(i.Substring("Name".Length)).Escape(testEntry.mName);
|
||||
}
|
||||
}
|
||||
testInstance.mTestEntries.Add(testEntry);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -951,15 +951,31 @@ void BfCompiler::EmitTestMethod(BfVDataModule* bfModule, Array<TestMethod>& 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))
|
||||
{
|
||||
BfFieldDef* fieldDef = field.mFieldRef;
|
||||
if (fieldDef->mName == "Name")
|
||||
{
|
||||
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";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue