Skip to content

Commit 75b1bc5

Browse files
committed
Support file inputs
#test
1 parent f225a4f commit 75b1bc5

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

src/test/TestRunner.cpp

+12-12
Original file line numberDiff line numberDiff line change
@@ -292,28 +292,28 @@ checkPath(
292292
namespace fs = llvm::sys::fs;
293293
namespace path = llvm::sys::path;
294294

295+
// See if inputPath references a file or directory
295296
inputPath = files::normalizePath(inputPath);
297+
auto fileType = files::getFileType(inputPath);
298+
if (!fileType)
299+
{
300+
return report::error("{}: \"{}\"", fileType.error(), inputPath);
301+
}
296302

297303
// Set the reference directories for the test
298-
dirs_.configDir = inputPath;
304+
std::string const inputDir = fileType == files::FileType::directory
305+
? inputPath
306+
: files::getParentDir(inputPath);
307+
dirs_.configDir = inputDir;
299308
dirs_.cwd = dirs_.configDir;
300309

301-
// See if inputPath references a file or directory
302-
auto fileType = files::getFileType(inputPath);
303-
if(! fileType)
304-
return report::error("{}: \"{}\"",
305-
fileType.error(), inputPath);
306-
307310
// Check for a directory-wide config
308311
Config::Settings dirSettings;
309312
testArgs.apply(dirSettings, dirs_, argv);
310313
dirSettings.multipage = false;
311314
dirSettings.sourceRoot = files::appendPath(inputPath, ".");
312-
dirSettings.stdlibIncludes.insert(
313-
dirSettings.stdlibIncludes.end(),
314-
testArgs.stdlibIncludes.begin(),
315-
testArgs.stdlibIncludes.end());
316-
std::string const& configPath = files::appendPath(inputPath, "mrdocs.yml");
315+
316+
std::string const& configPath = files::appendPath(inputDir, "mrdocs.yml");
317317
if (files::exists(configPath)) {
318318
Config::Settings::load_file(dirSettings, configPath, dirs_).value();
319319
if (auto exp = dirSettings.normalize(dirs_); !exp) {

0 commit comments

Comments
 (0)