From d03d23a6e5ec58699955dd951957532e5aea3a84 Mon Sep 17 00:00:00 2001 From: Hossein Ghahramanzadeh Date: Fri, 3 Dec 2021 01:45:10 +0100 Subject: Reimplement MatchesFilter with new interfaces. --- googletest/src/gtest-internal-inl.h | 4 ++++ googletest/src/gtest.cc | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/googletest/src/gtest-internal-inl.h b/googletest/src/gtest-internal-inl.h index 765d12d..0b25d2f 100644 --- a/googletest/src/gtest-internal-inl.h +++ b/googletest/src/gtest-internal-inl.h @@ -390,6 +390,10 @@ class GTEST_API_ UnitTestOptions { // This function is useful as an __except condition. static int GTestShouldProcessSEH(DWORD exception_code); #endif // GTEST_OS_WINDOWS + + // Returns true if "name" matches the ':' separated list of glob-style + // filters in "filter". + static bool MatchesFilter(const std::string& name, const char* filter); }; // Returns the current application's name, removing directory path if that diff --git a/googletest/src/gtest.cc b/googletest/src/gtest.cc index 259e7ce..1537fd2 100644 --- a/googletest/src/gtest.cc +++ b/googletest/src/gtest.cc @@ -797,6 +797,11 @@ class PositiveAndNegativeUnitTestFilter { }; } // namespace +bool UnitTestOptions::MatchesFilter(const std::string& name_str, + const char* filter) { + return UnitTestFilter{filter}.MatchesName(name_str); +} + // Returns true if and only if the user-specified filter matches the test // suite name and the test name. bool UnitTestOptions::FilterMatchesTest(const std::string& test_suite_name, -- cgit v0.12