From 25deb996e9d9d21fabb9b85d6f6422f661e36d5f Mon Sep 17 00:00:00 2001 From: Dmitry-Me Date: Tue, 11 Feb 2020 18:19:39 +0300 Subject: [PATCH] Improve test coverage for matching paths --- test/testpathmatch.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/testpathmatch.cpp b/test/testpathmatch.cpp index 12a765075..8ee91386f 100644 --- a/test/testpathmatch.cpp +++ b/test/testpathmatch.cpp @@ -48,6 +48,7 @@ private: TEST_CASE(onemasksamepath); TEST_CASE(onemasksamepathdifferentcase); TEST_CASE(onemasksamepathwithfile); + TEST_CASE(onemaskshorterpath); TEST_CASE(onemaskdifferentdir1); TEST_CASE(onemaskdifferentdir2); TEST_CASE(onemaskdifferentdir3); @@ -105,6 +106,15 @@ private: ASSERT(srcMatcher.match("src/file.txt")); } + void onemaskshorterpath() const { + const std::string longerExclude("longersrc/"); + const std::string shorterToMatch("src/"); + ASSERT(shorterToMatch.length() < longerExclude.length()); + PathMatch match(std::vector(1, longerExclude)); + ASSERT(match.match(longerExclude)); + ASSERT(!match.match(shorterToMatch)); + } + void onemaskdifferentdir1() const { ASSERT(!srcMatcher.match("srcfiles/file.txt")); }