gtest 初始化失败,如果在包内调用 InitGoogleTest

问题描述

我试图从我的 TestAPP 可执行文件调用位于可可包(其他项目输出目标是包)中的 runTest 函数。 但是 InitGoogleTest 函数失败并给出以下错误消息:

\nIMPORTANT NOTICE - DO NOT IGnorE:\n"
        "This test program did NOT call " GTEST_INIT_GOOGLE_TEST_NAME_
        "() before calling RUN_ALL_TESTS(). This is INVALID. Soon " GTEST_NAME_
        " will start to enforce the valid usage. "
        "Please fix it ASAP,or IT WILL START TO FAIL

我的 runtest 函数看起来像:

void runTests(int argc,char* argv[])
{
    testing::InitGoogleTest(&argc,argv);
    const int status = RUN_ALL_TESTS();
}

我正在使用 CoreFoundation API 加载包。

如果这种方法不正确,请告诉我。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)