From 7122af93796ccc2bd3f945ade91b135b328b55e4 Mon Sep 17 00:00:00 2001 From: sunrisepeak Date: Sat, 9 May 2026 08:10:08 +0800 Subject: [PATCH] fix(tests): drop redundant test_main.cpp main() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit mcpp expects the gtest dev-dep to provide `main` (gtest_main.cc, which the mcpp-index gtest descriptor compiles into libgtest.a). The hand-written `tests/test_main.cpp` body — `InitGoogleTest + RUN_ALL_TESTS` — is exactly what gtest_main does, and having both produces a `multiple definition of main` link error under `mcpp test`. The xmake test target was unaffected because xmake's gtest package ships gtest and gtest_main as separate libs; mcpp-index packs them together. Either way the convention `mcpp test` follows (and what mcpp's own tests rely on) is "let gtest_main provide main", so this file is just removed. --- tests/test_main.cpp | 6 ------ 1 file changed, 6 deletions(-) delete mode 100644 tests/test_main.cpp diff --git a/tests/test_main.cpp b/tests/test_main.cpp deleted file mode 100644 index 5ebbc76..0000000 --- a/tests/test_main.cpp +++ /dev/null @@ -1,6 +0,0 @@ -#include - -int main(int argc, char** argv) { - ::testing::InitGoogleTest(&argc, argv); - return RUN_ALL_TESTS(); -}