c++ - 如何让 Eclipse 控制台显示与终端中相同的 GoogleTests 输出?

标签 c++ eclipse console googletest eclipse-mars

我使用 GoogleTest广泛,控制台中的输出如下所示:

GoogleTest console output

当我从 Eclipse 中运行相同的程序时(使用今天最新的 Eclipse Mars),我得到以下没有颜色和垃圾字符的输出(只是将输出粘贴到这里是不可见的):

Running main() from gtest_main.cc
[0;32m[==========] [mRunning 3 tests from 1 test case.
[0;32m[----------] [mGlobal test environment set-up.
[0;32m[----------] [m3 tests from NloptAdapterSuite
[0;32m[ RUN      ] [mNloptAdapterSuite.testQuadraticFunction1
[0;32m[       OK ] [mNloptAdapterSuite.testQuadraticFunction1 (1 ms)
[0;32m[ RUN      ] [mNloptAdapterSuite.testQuadraticFunction1WithNoise
[0;32m[       OK ]     [mNloptAdapterSuite.testQuadraticFunction1WithNoise (1 ms)
[0;32m[ RUN      ] [mNloptAdapterSuite.testQuadraticFunction2
[0;32m[       OK ] [mNloptAdapterSuite.testQuadraticFunction2 (1 ms)
[0;32m[----------] [m3 tests from NloptAdapterSuite (3 ms total)

[0;32m[----------] [mGlobal test environment tear-down
[0;32m[==========] [m3 tests from 1 test case ran. (3 ms total)
[0;32m[  PASSED  ] [m3 tests.

如何解决这个问题以获得相同的输出?

最佳答案

greg-449 linkedANSI Escape in Console 插件以上对我很有用。安装后,gtest 输出如下所示:

gtest console output

我在使用 Neon.2 (Eclipse 4.6.2)。

关于c++ - 如何让 Eclipse 控制台显示与终端中相同的 GoogleTests 输出?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31719187/

相关文章:

c# - 从 C# 中的不同项目写入控制台应用程序项目

Javascript while 在控制台中不起作用

c++ - 将 SDL_PeepEvents 从 SDL 1.2.14 迁移到 SDL 1.3

c++ - 指向成员函数的指针的语法错误

java - Eclipse 桌面应用程序

java - 相同 JDK 上的相同代码可以在 Eclipse 上编译,但会在 Netbeans、IDEA 或命令行上导致类型不可转换

Python shell 不打印回车符

c++ - AES 库或 C++ 代码

c++ - 将 NULL 对象插入 std::vector

eclipse - P2 Touchpoint chmod 不起作用?