Skip to content

Commit

Permalink
Add count support to REPEAT
Browse files Browse the repository at this point in the history
  • Loading branch information
rfdavid committed Jun 28, 2023
1 parent faada3f commit 34d4c97
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions test/test_runner/test_parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ void TestParser::extractStatementBlock() {
}

std::string TestParser::parseCommand() {
// REPEAT 3 "Alice " = "Alice Alice Alice "
// REPEAT 3 "col${count}, " = "col0, col1, col2, "
if (currentToken.params[2] == "REPEAT") {
checkMinimumParams(4);
return parseCommandRepeat();
Expand All @@ -226,7 +226,9 @@ std::string TestParser::parseCommandRepeat() {
throw TestException("Invalid DEFINE data type [" + path + ":" + line + "].");
}
for (auto i = 0; i < times; i++) {
result += repeatString;
auto stringToAppend = repeatString;
StringUtils::replaceAll(stringToAppend, "${count}", std::to_string(i));
result += stringToAppend;
}
return result;
}
Expand Down

0 comments on commit 34d4c97

Please sign in to comment.