[Libreoffice-commits] core.git: Branch 'aoo/trunk' - tools/GoogleTest_tools_pathutils.mk tools/Module_tools.mk tools/qa
Damjan Jovanovic (via logerrit)
logerrit at kemper.freedesktop.org
Sun Mar 31 20:10:41 UTC 2019
tools/GoogleTest_tools_pathutils.mk | 46 ++++++++++++++++++++++++++++++++++++
tools/Module_tools.mk | 1
tools/qa/test_pathutils.cxx | 27 ++++++++++++---------
3 files changed, 63 insertions(+), 11 deletions(-)
New commits:
commit e665db4362b177a38f07a8392ebbb8f99ef6b6e9
Author: Damjan Jovanovic <damjan at apache.org>
AuthorDate: Sun Mar 31 18:17:42 2019 +0000
Commit: Damjan Jovanovic <damjan at apache.org>
CommitDate: Sun Mar 31 18:17:42 2019 +0000
Port a main/tools unit test from cppunit to gtest.
Patch by: me
diff --git a/tools/GoogleTest_tools_pathutils.mk b/tools/GoogleTest_tools_pathutils.mk
new file mode 100644
index 000000000000..58e0c6f5f897
--- /dev/null
+++ b/tools/GoogleTest_tools_pathutils.mk
@@ -0,0 +1,46 @@
+#**************************************************************
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+#**************************************************************
+
+
+$(eval $(call gb_GoogleTest_GoogleTest,tools_pathutils))
+
+$(eval $(call gb_GoogleTest_add_exception_objects,tools_pathutils, \
+ tools/qa/test_pathutils \
+))
+
+$(eval $(call gb_GoogleTest_add_linked_libs,tools_pathutils, \
+ stl \
+ tl \
+ $(gb_STDLIBS) \
+))
+
+
+$(eval $(call gb_GoogleTest_add_linked_static_libs,tools_pathutils, \
+ ooopathutils \
+))
+
+$(eval $(call gb_GoogleTest_set_include,tools_pathutils,\
+ $$(INCLUDE) \
+ -I$(SRCDIR)/inc \
+ -I$(SRCDIR)/tools/inc/pch \
+))
+
+# vim: set noet sw=4 ts=4:
diff --git a/tools/Module_tools.mk b/tools/Module_tools.mk
index 53a984177ad8..5f4ec4c6f488 100644
--- a/tools/Module_tools.mk
+++ b/tools/Module_tools.mk
@@ -37,6 +37,7 @@ $(eval $(call gb_Module_add_targets,tools,\
ifeq ($(ENABLE_UNIT_TESTS),YES)
$(eval $(call gb_Module_add_check_targets,tools,\
GoogleTest_tools_fractiontest \
+ GoogleTest_tools_pathutils \
))
endif
diff --git a/tools/qa/test_pathutils.cxx b/tools/qa/test_pathutils.cxx
index 2d771a1a3324..4e59b445b1f6 100644
--- a/tools/qa/test_pathutils.cxx
+++ b/tools/qa/test_pathutils.cxx
@@ -26,7 +26,7 @@
#include <cwchar>
-#include "testshl/simpleheader.hxx"
+#include "gtest/gtest.h"
#include "tools/pathutils.hxx"
namespace {
@@ -38,8 +38,8 @@ void buildPath(
wchar_t p[MAX_PATH];
wchar_t * e = tools::buildPath(
p, front, front + std::wcslen(front), back, std::wcslen(back));
- CPPUNIT_ASSERT_EQUAL(p + std::wcslen(path), e);
- CPPUNIT_ASSERT_EQUAL(0, std::wcscmp(path, p));
+ ASSERT_EQ(p + std::wcslen(path), e);
+ ASSERT_EQ(0, std::wcscmp(path, p));
#else
(void) front;
(void) back;
@@ -47,16 +47,18 @@ void buildPath(
#endif
}
-class Test: public CppUnit::TestFixture {
+class Test: public ::testing::Test {
public:
- void testBuildPath();
+ void SetUp()
+ {
+ }
- CPPUNIT_TEST_SUITE(Test);
- CPPUNIT_TEST(testBuildPath);
- CPPUNIT_TEST_SUITE_END();
+ void TearDown()
+ {
+ }
};
-void Test::testBuildPath() {
+TEST_F(Test, testBuildPath) {
buildPath(L"a:\\b\\", L"..", L"a:\\");
buildPath(L"a:\\b\\", L"..\\", L"a:\\");
buildPath(L"a:\\b\\c\\", L"..\\..\\..\\d", L"a:\\..\\d");
@@ -65,8 +67,11 @@ void Test::testBuildPath() {
buildPath(L"", L"..\\a", L"..\\a");
}
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(Test, "alltests");
+}
+int main(int argc, char **argv)
+{
+ ::testing::InitGoogleTest(&argc, argv);
+ return RUN_ALL_TESTS();
}
-NOADDITIONAL;
More information about the Libreoffice-commits
mailing list