Update Viatom tests to process folders of test data.

This commit is contained in:
sawinglogz 2020-01-26 20:05:14 -05:00
parent 4ebc7d3681
commit e11bdf2633

View File

@ -45,15 +45,19 @@ static void parseAndEmitSessionYaml(const QString & path)
void ViatomTests::testSessionsToYaml() void ViatomTests::testSessionsToYaml()
{ {
static const QString root = TESTDATA_PATH "viatom/input/"; static const QString root_path = TESTDATA_PATH "viatom/input/";
QDir dir(root); QDir root(root_path);
dir.setFilter(QDir::NoDotAndDotDot | QDir::Dirs | QDir::Files | QDir::Hidden | QDir::NoSymLinks); root.setFilter(QDir::NoDotAndDotDot | QDir::Dirs);
dir.setNameFilters(s_loader->getNameFilter()); root.setSorting(QDir::Name);
dir.setSorting(QDir::Name); for (auto & dir_info : root.entryInfoList()) {
QDir dir(dir_info.canonicalFilePath());
for (auto & fi : dir.entryInfoList()) { dir.setFilter(QDir::Files | QDir::Hidden);
parseAndEmitSessionYaml(fi.canonicalFilePath()); dir.setNameFilters(s_loader->getNameFilter());
dir.setSorting(QDir::Name);
for (auto & fi : dir.entryInfoList()) {
parseAndEmitSessionYaml(fi.canonicalFilePath());
}
} }
} }
@ -62,11 +66,12 @@ void ViatomTests::testSessionsToYaml()
QString viatomOutputPath(const QString & inpath, const QString & suffix) QString viatomOutputPath(const QString & inpath, const QString & suffix)
{ {
// Output to viatom/output/FILENAME(-session.yml, etc.) // Output to viatom/output/DIR/FILENAME(-session.yml, etc.)
QFileInfo path(inpath); QFileInfo path(inpath);
QString basename = path.fileName(); QString basename = path.fileName();
QString foldername = path.dir().dirName();
QDir outdir(TESTDATA_PATH "viatom/output"); QDir outdir(TESTDATA_PATH "viatom/output/" + foldername);
outdir.mkpath("."); outdir.mkpath(".");
QString filename = QString("%1%2") QString filename = QString("%1%2")