@@ -52,6 +52,7 @@ class TestPathMatch : public TestFixture {
5252 TEST_CASE (onemasklongerpath1);
5353 TEST_CASE (onemasklongerpath2);
5454 TEST_CASE (onemasklongerpath3);
55+ TEST_CASE (onemaskcwd);
5556 TEST_CASE (twomasklongerpath1);
5657 TEST_CASE (twomasklongerpath2);
5758 TEST_CASE (twomasklongerpath3);
@@ -60,10 +61,12 @@ class TestPathMatch : public TestFixture {
6061 TEST_CASE (filemaskdifferentcase);
6162 TEST_CASE (filemask2);
6263 TEST_CASE (filemask3);
64+ TEST_CASE (filemaskcwd);
6365 TEST_CASE (filemaskpath1);
6466 TEST_CASE (filemaskpath2);
6567 TEST_CASE (filemaskpath3);
6668 TEST_CASE (filemaskpath4);
69+ TEST_CASE (mixedallmatch);
6770 }
6871
6972 // Test empty PathMatch
@@ -146,6 +149,10 @@ class TestPathMatch : public TestFixture {
146149 ASSERT (srcMatcher.match (" project/src/module/" ));
147150 }
148151
152+ void onemaskcwd () const {
153+ ASSERT (!srcMatcher.match (" ./src" ));
154+ }
155+
149156 void twomasklongerpath1 () const {
150157 std::vector<std::string> masks = { " src/" , " module/" };
151158 PathMatch match (std::move (masks));
@@ -189,6 +196,10 @@ class TestPathMatch : public TestFixture {
189196 ASSERT (fooCppMatcher.match (" src/foo.cpp" ));
190197 }
191198
199+ void filemaskcwd () const {
200+ ASSERT (fooCppMatcher.match (" ./lib/foo.cpp" ));
201+ }
202+
192203 // Test PathMatch containing "src/foo.cpp"
193204 void filemaskpath1 () const {
194205 ASSERT (srcFooCppMatcher.match (" src/foo.cpp" ));
@@ -205,6 +216,14 @@ class TestPathMatch : public TestFixture {
205216 void filemaskpath4 () const {
206217 ASSERT (!srcFooCppMatcher.match (" bar/foo.cpp" ));
207218 }
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+ }
208227};
209228
210229REGISTER_TEST (TestPathMatch)
0 commit comments