From e05489605fc58736f837563db1fc33f9131ee810 Mon Sep 17 00:00:00 2001 From: vladlosev Date: Thu, 22 Apr 2010 11:44:59 +0000 Subject: Implements color output in GNU Screen sessions (issue 277). --- src/gtest.cc | 1 + test/gtest_unittest.cc | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/src/gtest.cc b/src/gtest.cc index 342d458..302c327 100644 --- a/src/gtest.cc +++ b/src/gtest.cc @@ -2592,6 +2592,7 @@ bool ShouldUseColor(bool stdout_is_tty) { String::CStringEquals(term, "xterm") || String::CStringEquals(term, "xterm-color") || String::CStringEquals(term, "xterm-256color") || + String::CStringEquals(term, "screen") || String::CStringEquals(term, "linux") || String::CStringEquals(term, "cygwin"); return stdout_is_tty && term_supports_color; diff --git a/test/gtest_unittest.cc b/test/gtest_unittest.cc index a14f065..adc0fff 100644 --- a/test/gtest_unittest.cc +++ b/test/gtest_unittest.cc @@ -6264,8 +6264,17 @@ TEST(ColoredOutputTest, UsesColorsWhenTermSupportsColors) { SetEnv("TERM", "xterm-color"); // TERM supports colors. EXPECT_TRUE(ShouldUseColor(true)); // Stdout is a TTY. + SetEnv("TERM", "xterm-256color"); // TERM supports colors. + EXPECT_TRUE(ShouldUseColor(true)); // Stdout is a TTY. + + SetEnv("TERM", "screen"); // TERM supports colors. + EXPECT_TRUE(ShouldUseColor(true)); // Stdout is a TTY. + SetEnv("TERM", "linux"); // TERM supports colors. EXPECT_TRUE(ShouldUseColor(true)); // Stdout is a TTY. + + SetEnv("TERM", "cygwin"); // TERM supports colors. + EXPECT_TRUE(ShouldUseColor(true)); // Stdout is a TTY. #endif // GTEST_OS_WINDOWS } -- cgit v0.12