Fixed #11395 (Cant exclude file)
This commit is contained in:
parent
a5c16af16d
commit
c26a8fb4ce
|
@ -182,6 +182,9 @@ static std::string addFiles2(std::map<std::string, std::size_t> &files,
|
|||
const PathMatch& ignored
|
||||
)
|
||||
{
|
||||
if (ignored.match(path))
|
||||
return "";
|
||||
|
||||
struct stat file_stat;
|
||||
if (stat(path.c_str(), &file_stat) != -1) {
|
||||
if ((file_stat.st_mode & S_IFMT) == S_IFDIR) {
|
||||
|
|
|
@ -43,6 +43,7 @@ private:
|
|||
|
||||
TEST_CASE(isDirectory);
|
||||
TEST_CASE(recursiveAddFiles);
|
||||
TEST_CASE(excludeFile);
|
||||
TEST_CASE(fileExists);
|
||||
}
|
||||
|
||||
|
@ -78,6 +79,15 @@ private:
|
|||
ASSERT(files.find("lib/tokenize.h") == files.end());
|
||||
}
|
||||
|
||||
void excludeFile() const {
|
||||
std::map<std::string, std::size_t> files;
|
||||
std::vector<std::string> ignored{"lib/token.cpp"};
|
||||
PathMatch matcher(ignored);
|
||||
std::string err = FileLister::recursiveAddFiles(files, "lib/token.cpp", matcher);
|
||||
ASSERT(err.empty());
|
||||
ASSERT(files.empty());
|
||||
}
|
||||
|
||||
void fileExists() const {
|
||||
ASSERT_EQUALS(false, FileLister::fileExists("lib"));
|
||||
ASSERT_EQUALS(true, FileLister::fileExists("readme.txt"));
|
||||
|
|
Loading…
Reference in New Issue