当我使用 Google Test 和 Google Mock 并将诊断级别设置为“信息”时,我收到如下消息:
Uninteresting mock function call - taking default action specified at:
src/pkgtest/test_Foo.cpp:216:
Function call: GetBar()
Returns: 4-byte object <00-00 00-00>
Stack trace:
Uninteresting mock function call - taking default action specified at:
src/pkgtest/test_Foo.cpp:126:
Function call: GetBaz()
Returns: {}
Stack trace:
unknown file: Failure
C++ exception with description "Uninteresting mock function call - returning default value.
Function call: CreateGrille(@0x7fff6a557050 { 16-byte object <80-D8 BB-01 00-00 00-00 70-D8 BB-01 00-00 00-00> })
The mock function has no default action set, and its return type has no default value set." thrown in the test body.
我在互联网上找不到任何关于为什么 Google Test/Mock 不会打印堆栈跟踪或声称“未知文件”的信息。我需要做什么来教它如何正确转储堆栈跟踪?
(我在 Linux 上使用 g++ 4.9,如果这有什么区别的话。)
根据塞缪尔·本扎昆的说法:
gTest 不包括堆栈展开器。您必须提供自己的。
您可以通过定义在 include/gtest/internal/custom/gtest.h 中执行此操作
GTEST_OS_STACK_TRACE_GETTER_ 宏指向一个实现
OsStackTraceGetter接口。
https://groups.google.com/d/msg/googletestframework/WMJuxAE7y-A/3FjexkRpEQAJ https://groups.google.com/d/msg/googletestframework/WMJuxAE7y-A/3FjexkRpEQAJ
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)