From 4fe31a20e37d9084a8e222a30253ae8e15513764 Mon Sep 17 00:00:00 2001 From: Matthieu Gautier Date: Mon, 20 Jan 2020 17:00:18 +0100 Subject: [PATCH] Fix tests. As we use the main library of gtest (if already installed) we don't need to (and must not) define a main function for the tests. Does the same (use main library) if we use the subproject. --- test/kiwixserve.cpp | 6 ------ test/library.cpp | 6 ------ test/meson.build | 2 +- test/parseUrl.cpp | 6 ------ test/pathTools.cpp | 5 ----- test/regex.cpp | 6 ------ test/stringTools.cpp | 5 ----- test/tagParsing.cpp | 5 ----- 8 files changed, 1 insertion(+), 40 deletions(-) diff --git a/test/kiwixserve.cpp b/test/kiwixserve.cpp index 5f68608f6..eeb3a57f0 100644 --- a/test/kiwixserve.cpp +++ b/test/kiwixserve.cpp @@ -10,9 +10,3 @@ TEST(KiwixServeTest, PortTest) EXPECT_EQ(kiwixServe.setPort(0), -1); EXPECT_EQ(kiwixServe.setPort(3456789), -1); } - -int main(int argc, char** argv) -{ - ::testing::InitGoogleTest(&argc, argv); - return RUN_ALL_TESTS(); -} \ No newline at end of file diff --git a/test/library.cpp b/test/library.cpp index b6946df23..3f4921789 100644 --- a/test/library.cpp +++ b/test/library.cpp @@ -259,9 +259,3 @@ TEST_F(LibraryTest, filterCheck) } }; - -int main(int argc, char** argv) -{ - ::testing::InitGoogleTest(&argc, argv); - return RUN_ALL_TESTS(); -} diff --git a/test/meson.build b/test/meson.build index 2a0bf621e..2a8e93bc2 100644 --- a/test/meson.build +++ b/test/meson.build @@ -13,7 +13,7 @@ tests = [ gtest_dep = dependency('gtest', main:true, - fallback: ['gtest', 'gtest_dep'], + fallback: ['gtest', 'gtest_main_dep'], required:false) if gtest_dep.found() diff --git a/test/parseUrl.cpp b/test/parseUrl.cpp index dbb4d1790..58855bcd5 100644 --- a/test/parseUrl.cpp +++ b/test/parseUrl.cpp @@ -65,9 +65,3 @@ TEST(ParseUrlTest, valid) ASSERT_EQ(title, "/title"); } }; - -int main(int argc, char** argv) -{ - ::testing::InitGoogleTest(&argc, argv); - return RUN_ALL_TESTS(); -} diff --git a/test/pathTools.cpp b/test/pathTools.cpp index 458d7e10e..4c86d6234 100644 --- a/test/pathTools.cpp +++ b/test/pathTools.cpp @@ -227,8 +227,3 @@ TEST(pathTools, WideToUtf8) }; -int main(int argc, char** argv) -{ - ::testing::InitGoogleTest(&argc, argv); - return RUN_ALL_TESTS(); -} diff --git a/test/regex.cpp b/test/regex.cpp index bdcd132ab..e70bd1670 100644 --- a/test/regex.cpp +++ b/test/regex.cpp @@ -101,9 +101,3 @@ TEST(append, middle) } }; - -int main(int argc, char** argv) -{ - ::testing::InitGoogleTest(&argc, argv); - return RUN_ALL_TESTS(); -} diff --git a/test/stringTools.cpp b/test/stringTools.cpp index 28e717f53..5e0b133c8 100644 --- a/test/stringTools.cpp +++ b/test/stringTools.cpp @@ -54,8 +54,3 @@ TEST(stringTools, split) } }; -int main(int argc, char** argv) -{ - ::testing::InitGoogleTest(&argc, argv); - return RUN_ALL_TESTS(); -} diff --git a/test/tagParsing.cpp b/test/tagParsing.cpp index 9e90519b5..ced648966 100644 --- a/test/tagParsing.cpp +++ b/test/tagParsing.cpp @@ -95,8 +95,3 @@ TEST(ParseTagTest, invalid) } }; -int main(int argc, char** argv) -{ - ::testing::InitGoogleTest(&argc, argv); - return RUN_ALL_TESTS(); -}