Update to the Latest googletest Version and Changed the if define Style#279
Open
fangjunzhou wants to merge 2 commits into
Open
Update to the Latest googletest Version and Changed the if define Style#279fangjunzhou wants to merge 2 commits into
fangjunzhou wants to merge 2 commits into
Conversation
When built with MinGW, Google Test emits ANSI escape sequences for color output like non-Windows platforms. This works with MSYS2's terminal ([`mintty.exe`](https://mintty.github.io/)) that intercepts stdout with a pipe and then renders color itself, but not with the native Windows Command Prompt (i.e. [conhost.exe in Windows 7 onwards, and csrss.exe earlier](https://devblogs.microsoft.com/commandline/windows-command-line-inside-the-windows-console/#so-whats-inside-the-windows-console)) that expect the Windows Console API to be used. This is arguably incorrect as the MinGW toolchain is intended for building native Windows programs, independent of any POSIX-like environment. Change the color-output behavior of MinGW-built Google Test to be conditional: - If stdout is a TTY, use the Windows Console API. - If stdout is not a TTY but the user specified `--gtest_color=yes`, use ANSI escape sequences. Behavior when built with any other compiler is unaffected. So Windows desktop toolchains (MSVC, C++Builder, etc.) will continue to use the Windows Console API unconditionally, while Cygwin, MSYS (not MinGW) and all other non-Windows toolchains will continue to use ANSI escape sequences unconditionally. Fixes: google#2809
Merged tanzislam:fix-color-output-with-mingw-in-conhost into main. Changed the old if define macro to the new style.
Author
|
It seems that your branch is outdated, and GitHub is displaying too many old commits. For your information, this is the change I made: 641f105 |
43f5258 to
94b7368
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I merged your branch to the latest google test main branch. I found they are using a new
#if definedstyle. I changed your macro to the new style. It works perfectly for me. I can finally have colorful test output! Thank you for your PR!!