Allow ArgumentParserTests to pass when working dir present within testfiles dir

This commit is contained in:
Martchus 2020-06-16 01:03:39 +02:00
parent a9453483a7
commit 940593429a
2 changed files with 3 additions and 3 deletions

0
testfiles/subdir/foo/bar Normal file
View File

View File

@ -671,14 +671,14 @@ void ArgumentParserTests::testBashCompletion()
} }
// directory names // directory names
string directoryPath = iniFilePath.substr(0, iniFilePath.size() - 4); string directoryPath = CppUtilities::testFilePath("subdir/foo/bar");
directoryPath.resize(directoryPath.size() - 4);
filesArg.setValueCompletionBehavior(ValueCompletionBehavior::Directories); filesArg.setValueCompletionBehavior(ValueCompletionBehavior::Directories);
parser.resetArgs(); parser.resetArgs();
const char *const argv14[] = { "get", "--files", directoryPath.c_str() }; const char *const argv14[] = { "get", "--files", directoryPath.c_str() };
{ {
#ifdef CPP_UTILITIES_USE_STANDARD_FILESYSTEM #ifdef CPP_UTILITIES_USE_STANDARD_FILESYSTEM
// order for file names is not specified const OutputCheck c("COMPREPLY=('" % directoryPath + "' ); compopt -o filenames\n");
const OutputCheck c("COMPREPLY=('" % directoryPath + "subdir' ); compopt -o filenames\n");
#else #else
const OutputCheck c("COMPREPLY=()\n"); const OutputCheck c("COMPREPLY=()\n");
#endif #endif