mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-07-11 22:03:01 -06:00
Added GTest.usc script to gtest that allows launch test directly from code editor.
git-svn-id: svn://ultimatepp.org/upp/trunk@10461 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
da6ba3c0e4
commit
04cba6245a
2 changed files with 54 additions and 0 deletions
52
bazaar/plugin/gtest/GTest.usc
Normal file
52
bazaar/plugin/gtest/GTest.usc
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
fn FindInTest(line, type) {
|
||||
startPos = -1;
|
||||
midPos = -1;
|
||||
endPos = -1;
|
||||
|
||||
for (i = 0; i < count(line); i++) {
|
||||
if (line[i] == '(') {
|
||||
startPos = i;
|
||||
}
|
||||
else if (line[i] == ',') {
|
||||
midPos = i;
|
||||
}
|
||||
else if (line[i] == ')') {
|
||||
endPos = i;
|
||||
}
|
||||
}
|
||||
|
||||
switch (type) {
|
||||
case(0):
|
||||
return line[startPos + 1 : midPos];
|
||||
case(1):
|
||||
return line[midPos + 1: endPos];
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
macro "Google Test" : "Launch all tests" Ctrl+R {
|
||||
Execute(Target());
|
||||
}
|
||||
|
||||
macro "Google Test" : "Launch test" Ctrl+E {
|
||||
ClearConsole();
|
||||
|
||||
currentLine = GetLine(GetCursor());
|
||||
currentLineLength = GetLineLength(currentLine);
|
||||
if (currentLineLength == 0) {
|
||||
Echo("plugin/gtest/GTest.usc: The line is empty.");
|
||||
return;
|
||||
}
|
||||
currentLineValue = Get(GetLinePos(currentLine), currentLineLength);
|
||||
testGroup = replace(FindInTest(currentLineValue, 0), " ", "");
|
||||
testName = replace(FindInTest(currentLineValue, 1), " ", "");
|
||||
|
||||
target = Target();
|
||||
if (count(target) == 0) {
|
||||
Echo("plugin/gtest/GTest.usc: Target is unknown. You need to build your project first.");
|
||||
return;
|
||||
}
|
||||
|
||||
Execute(target + " " + "--gtest_filter=" + testGroup + "." + testName);
|
||||
}
|
||||
|
|
@ -42,6 +42,8 @@ file
|
|||
internal/custom/gtest.h,
|
||||
internal/custom/gtest-printers.h,
|
||||
internal/custom/gtest-port.h,
|
||||
Additions readonly separator,
|
||||
GTest.usc,
|
||||
Info readonly separator,
|
||||
Copying;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue