Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
googletest
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
googletest
Commits
6b7a167d
Commit
6b7a167d
authored
Mar 11, 2013
by
zhanyong.wan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Supports colored output on term type screen-256color.
Proposed as a one-line patch by Tom Jakubowski (tom@crystae.net); finished by Zhanyong Wan.
parent
fc01f532
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
1 deletion
+5
-1
gtest.cc
src/gtest.cc
+2
-1
gtest_unittest.cc
test/gtest_unittest.cc
+3
-0
No files found.
src/gtest.cc
View file @
6b7a167d
...
@@ -204,7 +204,7 @@ GTEST_DEFINE_string_(
...
@@ -204,7 +204,7 @@ GTEST_DEFINE_string_(
"Whether to use colors in the output. Valid values: yes, no, "
"Whether to use colors in the output. Valid values: yes, no, "
"and auto. 'auto' means to use colors if the output is "
"and auto. 'auto' means to use colors if the output is "
"being sent to a terminal and the TERM environment variable "
"being sent to a terminal and the TERM environment variable "
"is set to
xterm, xterm-color, xterm-256color, linux or cygwin
."
);
"is set to
a terminal type that supports colors
."
);
GTEST_DEFINE_string_
(
GTEST_DEFINE_string_
(
filter
,
filter
,
...
@@ -2497,6 +2497,7 @@ bool ShouldUseColor(bool stdout_is_tty) {
...
@@ -2497,6 +2497,7 @@ bool ShouldUseColor(bool stdout_is_tty) {
String
::
CStringEquals
(
term
,
"xterm-color"
)
||
String
::
CStringEquals
(
term
,
"xterm-color"
)
||
String
::
CStringEquals
(
term
,
"xterm-256color"
)
||
String
::
CStringEquals
(
term
,
"xterm-256color"
)
||
String
::
CStringEquals
(
term
,
"screen"
)
||
String
::
CStringEquals
(
term
,
"screen"
)
||
String
::
CStringEquals
(
term
,
"screen-256color"
)
||
String
::
CStringEquals
(
term
,
"linux"
)
||
String
::
CStringEquals
(
term
,
"linux"
)
||
String
::
CStringEquals
(
term
,
"cygwin"
);
String
::
CStringEquals
(
term
,
"cygwin"
);
return
stdout_is_tty
&&
term_supports_color
;
return
stdout_is_tty
&&
term_supports_color
;
...
...
test/gtest_unittest.cc
View file @
6b7a167d
...
@@ -6429,6 +6429,9 @@ TEST(ColoredOutputTest, UsesColorsWhenTermSupportsColors) {
...
@@ -6429,6 +6429,9 @@ TEST(ColoredOutputTest, UsesColorsWhenTermSupportsColors) {
SetEnv
(
"TERM"
,
"screen"
);
// TERM supports colors.
SetEnv
(
"TERM"
,
"screen"
);
// TERM supports colors.
EXPECT_TRUE
(
ShouldUseColor
(
true
));
// Stdout is a TTY.
EXPECT_TRUE
(
ShouldUseColor
(
true
));
// Stdout is a TTY.
SetEnv
(
"TERM"
,
"screen-256color"
);
// TERM supports colors.
EXPECT_TRUE
(
ShouldUseColor
(
true
));
// Stdout is a TTY.
SetEnv
(
"TERM"
,
"linux"
);
// TERM supports colors.
SetEnv
(
"TERM"
,
"linux"
);
// TERM supports colors.
EXPECT_TRUE
(
ShouldUseColor
(
true
));
// Stdout is a TTY.
EXPECT_TRUE
(
ShouldUseColor
(
true
));
// Stdout is a TTY.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment