Add unit tests for most of util.cpp

This commit is contained in:
2021-07-30 13:22:23 -04:00
parent 49484cf2f0
commit ec4d5fc3da
7 changed files with 118 additions and 63 deletions

View File

@@ -20,9 +20,9 @@
// - remove blank lines
// - remove comment lines
//
util::stringvec read_control_lst(const std::string &path) {
util::stringvec lines = util::get_file_lines(path);
util::stringvec result;
util::StringVec read_control_lst(const std::string &path) {
util::StringVec lines = util::get_file_lines(path);
util::StringVec result;
for (int i = 0; i < int(lines.size()); i++) {
std::string trimmed = util::trim(lines[i]);
if ((trimmed.size() > 0) && (trimmed[0] != '#')) {
@@ -173,7 +173,7 @@ void SourceDB::update() {
}
// Read the list of filenames.
util::stringvec filenames = read_control_lst("lua/control.lst");
util::StringVec filenames = read_control_lst("lua/control.lst");
if (filenames.empty()) {
luaL_error(L, "cannot read source database control.lst");
}