summaryrefslogtreecommitdiff
path: root/sal
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2016-01-26 10:30:47 +0100
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2016-01-26 14:57:09 +0000
commit2a3a9dec50068321125e4a76de7042bf2d741bc7 (patch)
tree1ae66998b0450587b078d0471e52fe032c304a3c /sal
parent5d29ed1801a07d4649e095c25935b50f5ad32eb4 (diff)
support unnamed namespaces with CPPUNIT_TEST_NAME
Change-Id: I1ce50ce0ce8a4a461d1b2a34de132cbf57dd7d25 Reviewed-on: https://gerrit.libreoffice.org/21802 Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com> Tested-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Diffstat (limited to 'sal')
-rw-r--r--sal/cppunittester/cppunittester.cxx18
1 files changed, 17 insertions, 1 deletions
diff --git a/sal/cppunittester/cppunittester.cxx b/sal/cppunittester/cppunittester.cxx
index 34911e27e62c..fb9f85f06e00 100644
--- a/sal/cppunittester/cppunittester.cxx
+++ b/sal/cppunittester/cppunittester.cxx
@@ -171,13 +171,29 @@ private:
namespace {
+struct test_name_compare
+{
+ test_name_compare(const std::string& rName):
+ maName(rName)
+ {
+ }
+
+ bool operator()(const std::string& rCmp)
+ {
+ size_t nEndPos = maName.find(rCmp) + rCmp.size();
+ return nEndPos == maName.size();
+ }
+
+ std::string maName;
+};
+
void addRecursiveTests(const std::vector<std::string>& test_names, CppUnit::Test* pTest, CppUnit::TestRunner& rRunner)
{
for (int i = 0; i < pTest->getChildTestCount(); ++i)
{
CppUnit::Test* pNewTest = pTest->getChildTestAt(i);
addRecursiveTests(test_names, pNewTest, rRunner);
- if (std::find(test_names.begin(), test_names.end(), pNewTest->getName()) != test_names.end())
+ if (std::find_if(test_names.begin(), test_names.end(), test_name_compare(pNewTest->getName())) != test_names.end())
rRunner.addTest(pNewTest);
}
}