Skip to content

Commit

Permalink
Add test for empty string or comment
Browse files Browse the repository at this point in the history
---
Signed-off-by: Michael Ferguson <[email protected]>
  • Loading branch information
mppf committed Aug 11, 2022
1 parent 1ee3d2d commit 71ea54f
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions compiler/dyno/test/util/testSubprocess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,34 @@ static void checkEnv() {
cmd.push_back("/usr/bin/env");
rc = executeAndWait(cmd, "testing that env can be run", true);
assert(rc == 0);
}

// check that running an empty command or a comment returns 0
static void checkEmptyOrComment() {
int rc;
std::vector<std::string> cmd;

cmd.clear();
rc = executeAndWait(cmd, "empty command 1", true);
assert(rc == 0);

cmd.clear();
cmd.push_back("");
rc = executeAndWait(cmd, "empty command 2", true);
assert(rc == 0);

cmd.clear();
cmd.push_back("# this is a comment");
rc = executeAndWait(cmd, "comment command", true);
assert(rc == 0);
}


int main(int argc, char** argv) {

checkNonexistent();
checkEnv();
checkEmptyOrComment();

return 0;
}

0 comments on commit 71ea54f

Please sign in to comment.