@@ -52,6 +52,7 @@ class TestPathMatch : public TestFixture {
52
52
TEST_CASE (onemasklongerpath1);
53
53
TEST_CASE (onemasklongerpath2);
54
54
TEST_CASE (onemasklongerpath3);
55
+ TEST_CASE (onemaskcwd);
55
56
TEST_CASE (twomasklongerpath1);
56
57
TEST_CASE (twomasklongerpath2);
57
58
TEST_CASE (twomasklongerpath3);
@@ -60,10 +61,12 @@ class TestPathMatch : public TestFixture {
60
61
TEST_CASE (filemaskdifferentcase);
61
62
TEST_CASE (filemask2);
62
63
TEST_CASE (filemask3);
64
+ TEST_CASE (filemaskcwd);
63
65
TEST_CASE (filemaskpath1);
64
66
TEST_CASE (filemaskpath2);
65
67
TEST_CASE (filemaskpath3);
66
68
TEST_CASE (filemaskpath4);
69
+ TEST_CASE (mixedallmatch);
67
70
}
68
71
69
72
// Test empty PathMatch
@@ -146,6 +149,10 @@ class TestPathMatch : public TestFixture {
146
149
ASSERT (srcMatcher.match (" project/src/module/" ));
147
150
}
148
151
152
+ void onemaskcwd () const {
153
+ ASSERT (!srcMatcher.match (" ./src" ));
154
+ }
155
+
149
156
void twomasklongerpath1 () const {
150
157
std::vector<std::string> masks = { " src/" , " module/" };
151
158
PathMatch match (std::move (masks));
@@ -189,6 +196,10 @@ class TestPathMatch : public TestFixture {
189
196
ASSERT (fooCppMatcher.match (" src/foo.cpp" ));
190
197
}
191
198
199
+ void filemaskcwd () const {
200
+ ASSERT (fooCppMatcher.match (" ./lib/foo.cpp" ));
201
+ }
202
+
192
203
// Test PathMatch containing "src/foo.cpp"
193
204
void filemaskpath1 () const {
194
205
ASSERT (srcFooCppMatcher.match (" src/foo.cpp" ));
@@ -205,6 +216,14 @@ class TestPathMatch : public TestFixture {
205
216
void filemaskpath4 () const {
206
217
ASSERT (!srcFooCppMatcher.match (" bar/foo.cpp" ));
207
218
}
219
+
220
+ void mixedallmatch () const { // #13570
221
+ // when trying to match a directory against a directory entry it erroneously modified a local variable also used for file matching
222
+ std::vector<std::string> masks = { " tests/" , " file.c" };
223
+ PathMatch match (std::move (masks));
224
+ ASSERT (match.match (" tests/" ));
225
+ ASSERT (match.match (" lib/file.c" ));
226
+ }
208
227
};
209
228
210
229
REGISTER_TEST (TestPathMatch)
0 commit comments