Renamed PathMatch::Match to PathMatch::match
This commit is contained in:
parent
252fab2181
commit
515e84ed00
|
@ -122,7 +122,7 @@ void FileLister::recursiveAddFiles(std::map<std::string, std::size_t> &files, co
|
|||
|
||||
if ((ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0) {
|
||||
// File
|
||||
if ((!checkAllFilesInDir || Path::acceptFile(fname, extra)) && !ignored.Match(fname)) {
|
||||
if ((!checkAllFilesInDir || Path::acceptFile(fname, extra)) && !ignored.match(fname)) {
|
||||
const std::string nativename = Path::fromNativeSeparators(fname);
|
||||
|
||||
// Limitation: file sizes are assumed to fit in a 'size_t'
|
||||
|
@ -197,11 +197,11 @@ static void addFiles2(std::map<std::string, std::size_t> &files,
|
|||
new_path = path + '/' + dir_result->d_name;
|
||||
|
||||
if (dir_result->d_type == DT_DIR || (dir_result->d_type == DT_UNKNOWN && FileLister::isDirectory(new_path))) {
|
||||
if (recursive && !ignored.Match(new_path)) {
|
||||
if (recursive && !ignored.match(new_path)) {
|
||||
addFiles2(files, new_path, extra, recursive, ignored);
|
||||
}
|
||||
} else {
|
||||
if (Path::acceptFile(new_path, extra) && !ignored.Match(new_path)) {
|
||||
if (Path::acceptFile(new_path, extra) && !ignored.match(new_path)) {
|
||||
files[new_path] = file_stat.st_size;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -71,66 +71,66 @@ private:
|
|||
|
||||
// Test empty PathMatch
|
||||
void emptymaskemptyfile() const {
|
||||
ASSERT(!emptyMatcher.Match(""));
|
||||
ASSERT(!emptyMatcher.match(""));
|
||||
}
|
||||
|
||||
void emptymaskpath1() const {
|
||||
ASSERT(!emptyMatcher.Match("src/"));
|
||||
ASSERT(!emptyMatcher.match("src/"));
|
||||
}
|
||||
|
||||
void emptymaskpath2() const {
|
||||
ASSERT(!emptyMatcher.Match("../src/"));
|
||||
ASSERT(!emptyMatcher.match("../src/"));
|
||||
}
|
||||
|
||||
void emptymaskpath3() const {
|
||||
ASSERT(!emptyMatcher.Match("/home/user/code/src/"));
|
||||
ASSERT(!emptyMatcher.match("/home/user/code/src/"));
|
||||
}
|
||||
|
||||
// Test PathMatch containing "src/"
|
||||
void onemaskemptypath() const {
|
||||
ASSERT(!srcMatcher.Match(""));
|
||||
ASSERT(!srcMatcher.match(""));
|
||||
}
|
||||
|
||||
void onemasksamepath() const {
|
||||
ASSERT(srcMatcher.Match("src/"));
|
||||
ASSERT(srcMatcher.match("src/"));
|
||||
}
|
||||
|
||||
void onemasksamepathdifferentcase() const {
|
||||
std::vector<std::string> masks(1, "sRc/");
|
||||
PathMatch match(masks, false);
|
||||
ASSERT(match.Match("srC/"));
|
||||
ASSERT(match.match("srC/"));
|
||||
}
|
||||
|
||||
void onemasksamepathwithfile() const {
|
||||
ASSERT(srcMatcher.Match("src/file.txt"));
|
||||
ASSERT(srcMatcher.match("src/file.txt"));
|
||||
}
|
||||
|
||||
void onemaskdifferentdir1() const {
|
||||
ASSERT(!srcMatcher.Match("srcfiles/file.txt"));
|
||||
ASSERT(!srcMatcher.match("srcfiles/file.txt"));
|
||||
}
|
||||
|
||||
void onemaskdifferentdir2() const {
|
||||
ASSERT(!srcMatcher.Match("proj/srcfiles/file.txt"));
|
||||
ASSERT(!srcMatcher.match("proj/srcfiles/file.txt"));
|
||||
}
|
||||
|
||||
void onemaskdifferentdir3() const {
|
||||
ASSERT(!srcMatcher.Match("proj/mysrc/file.txt"));
|
||||
ASSERT(!srcMatcher.match("proj/mysrc/file.txt"));
|
||||
}
|
||||
|
||||
void onemaskdifferentdir4() const {
|
||||
ASSERT(!srcMatcher.Match("proj/mysrcfiles/file.txt"));
|
||||
ASSERT(!srcMatcher.match("proj/mysrcfiles/file.txt"));
|
||||
}
|
||||
|
||||
void onemasklongerpath1() const {
|
||||
ASSERT(srcMatcher.Match("/tmp/src/"));
|
||||
ASSERT(srcMatcher.match("/tmp/src/"));
|
||||
}
|
||||
|
||||
void onemasklongerpath2() const {
|
||||
ASSERT(srcMatcher.Match("src/module/"));
|
||||
ASSERT(srcMatcher.match("src/module/"));
|
||||
}
|
||||
|
||||
void onemasklongerpath3() const {
|
||||
ASSERT(srcMatcher.Match("project/src/module/"));
|
||||
ASSERT(srcMatcher.match("project/src/module/"));
|
||||
}
|
||||
|
||||
void twomasklongerpath1() const {
|
||||
|
@ -138,7 +138,7 @@ private:
|
|||
masks.push_back("src/");
|
||||
masks.push_back("module/");
|
||||
PathMatch match(masks);
|
||||
ASSERT(!match.Match("project/"));
|
||||
ASSERT(!match.match("project/"));
|
||||
}
|
||||
|
||||
void twomasklongerpath2() const {
|
||||
|
@ -146,7 +146,7 @@ private:
|
|||
masks.push_back("src/");
|
||||
masks.push_back("module/");
|
||||
PathMatch match(masks);
|
||||
ASSERT(match.Match("project/src/"));
|
||||
ASSERT(match.match("project/src/"));
|
||||
}
|
||||
|
||||
void twomasklongerpath3() const {
|
||||
|
@ -154,7 +154,7 @@ private:
|
|||
masks.push_back("src/");
|
||||
masks.push_back("module/");
|
||||
PathMatch match(masks);
|
||||
ASSERT(match.Match("project/module/"));
|
||||
ASSERT(match.match("project/module/"));
|
||||
}
|
||||
|
||||
void twomasklongerpath4() const {
|
||||
|
@ -162,43 +162,43 @@ private:
|
|||
masks.push_back("src/");
|
||||
masks.push_back("module/");
|
||||
PathMatch match(masks);
|
||||
ASSERT(match.Match("project/src/module/"));
|
||||
ASSERT(match.match("project/src/module/"));
|
||||
}
|
||||
|
||||
// Test PathMatch containing "foo.cpp"
|
||||
void filemask1() const {
|
||||
ASSERT(fooCppMatcher.Match("foo.cpp"));
|
||||
ASSERT(fooCppMatcher.match("foo.cpp"));
|
||||
}
|
||||
|
||||
void filemaskdifferentcase() const {
|
||||
std::vector<std::string> masks(1, "foo.cPp");
|
||||
PathMatch match(masks, false);
|
||||
ASSERT(match.Match("fOo.cpp"));
|
||||
ASSERT(match.match("fOo.cpp"));
|
||||
}
|
||||
|
||||
void filemask2() const {
|
||||
ASSERT(fooCppMatcher.Match("../foo.cpp"));
|
||||
ASSERT(fooCppMatcher.match("../foo.cpp"));
|
||||
}
|
||||
|
||||
void filemask3() const {
|
||||
ASSERT(fooCppMatcher.Match("src/foo.cpp"));
|
||||
ASSERT(fooCppMatcher.match("src/foo.cpp"));
|
||||
}
|
||||
|
||||
// Test PathMatch containing "src/foo.cpp"
|
||||
void filemaskpath1() const {
|
||||
ASSERT(srcFooCppMatcher.Match("src/foo.cpp"));
|
||||
ASSERT(srcFooCppMatcher.match("src/foo.cpp"));
|
||||
}
|
||||
|
||||
void filemaskpath2() const {
|
||||
ASSERT(srcFooCppMatcher.Match("proj/src/foo.cpp"));
|
||||
ASSERT(srcFooCppMatcher.match("proj/src/foo.cpp"));
|
||||
}
|
||||
|
||||
void filemaskpath3() const {
|
||||
ASSERT(!srcFooCppMatcher.Match("foo.cpp"));
|
||||
ASSERT(!srcFooCppMatcher.match("foo.cpp"));
|
||||
}
|
||||
|
||||
void filemaskpath4() const {
|
||||
ASSERT(!srcFooCppMatcher.Match("bar/foo.cpp"));
|
||||
ASSERT(!srcFooCppMatcher.match("bar/foo.cpp"));
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue