- Fixing bug that yielded empty expanded command sets.

This commit is contained in:
Ian Roddis
2021-08-20 10:58:10 -03:00
parent 1668117566
commit de8025e0f9
2 changed files with 3 additions and 5 deletions

View File

@@ -17,8 +17,9 @@ namespace daggy {
std::vector<std::vector<std::string>> commands{{}};
for (const auto &part : command) {
std::vector<std::string> expandedPart;
std::vector<std::string> expandedPart{part};
// Find all values of parameters, and expand them
for (const auto &[param, paramValue] : parameters) {
auto pos = part.find(param);
if (pos == std::string::npos) continue;

View File

@@ -49,10 +49,7 @@ TEST_CASE("Parameter Expansion", "[utilities_parameter_expansion]") {
// TYPE isn't used, so it's just |DATE| * |SOURCE|
REQUIRE(result.size() == 4);
for (const auto &command : result) {
std::copy(command.begin(), command.end(), std::ostream_iterator<std::string>(std::cout, " "));
std::cout << std::endl;
}
}
}