Google test how to set flag (e.g., --gtest_color) in Clion?
Answered
I am new to google test. In Clion, I don't know where to set those flags, e.g., --gtest_color=no or --gtest_print_time. I tried the program arguments, but it doesn't work. Anyone know how to do this?
Please sign in to leave a comment.
Hello!
You're right, those flags should be specified in the "Program arguments" field of your Google Test run/debug configuration:
BTW, the --gtest_color=no flag is set automatically:
What flags would you like to set and what exactly doesn't work?
Thanks for your reply. I set gtest_color and gtest_print_time. I found the latter actually worked. But gtest_color=yes does not work. It's overwritten by the default --gtest_color=no at the end of command. Do we have a way to remove the default gtest_color flag?
No, there is no way to remove the --gtest_color=no flag, and there are no plans to add such possibility.
That's really unfortunate that --gtest_color=no is hardcoded and you intend to keep it that way. I also can't find a reason why the --gtest_filter= is hardcoded into the plugin.
This is a seriously unhelpful answer Anna. Colour support in the test body can help with debugging.
Feel free to create a feature request in our tracker: https://youtrack.jetbrains.com/issues/CPP.
Given that I can *add* program arguments, I don't see the point in having some arbitrary arguments hardcoded there. I don't want `--gtest_filter=*` (because it does not work), but I can't remove it. If it was not there, I could add it in the program arguments.
In trying to make it slightly more convenient for some users, it makes it unusable for others.