From 4b7f9453c5fbb0614cec13565ff98ab87aa83fbe Mon Sep 17 00:00:00 2001 From: Denis Hananein Date: Thu, 10 Nov 2022 17:08:48 +0100 Subject: [PATCH] Support kitty TERM Signed-off-by: Denis Hananein --- googletest/src/gtest.cc | 1 + googletest/test/googletest-color-test.py | 1 + googletest/test/gtest_unittest.cc | 3 +++ 3 files changed, 5 insertions(+) diff --git a/googletest/src/gtest.cc b/googletest/src/gtest.cc index 38594528..cc56752a 100644 --- a/googletest/src/gtest.cc +++ b/googletest/src/gtest.cc @@ -3257,6 +3257,7 @@ bool ShouldUseColor(bool stdout_is_tty) { const bool term_supports_color = term != nullptr && ( String::CStringEquals(term, "xterm") || String::CStringEquals(term, "xterm-color") || + String::CStringEquals(term, "xterm-kitty") || String::CStringEquals(term, "screen") || String::CStringEquals(term, "tmux") || String::CStringEquals(term, "rxvt-unicode") || diff --git a/googletest/test/googletest-color-test.py b/googletest/test/googletest-color-test.py index c22752db..f08edf70 100755 --- a/googletest/test/googletest-color-test.py +++ b/googletest/test/googletest-color-test.py @@ -78,6 +78,7 @@ class GTestColorTest(gtest_test_utils.TestCase): self.assert_(UsesColor('cygwin', None, None)) self.assert_(UsesColor('xterm', None, None)) self.assert_(UsesColor('xterm-color', None, None)) + self.assert_(UsesColor('xterm-kitty', None, None)) self.assert_(UsesColor('xterm-256color', None, None)) def testFlagOnly(self): diff --git a/googletest/test/gtest_unittest.cc b/googletest/test/gtest_unittest.cc index 329ca546..8bd21be9 100644 --- a/googletest/test/gtest_unittest.cc +++ b/googletest/test/gtest_unittest.cc @@ -6636,6 +6636,9 @@ TEST(ColoredOutputTest, UsesColorsWhenTermSupportsColors) { SetEnv("TERM", "xterm-color"); // TERM supports colors. EXPECT_TRUE(ShouldUseColor(true)); // Stdout is a TTY. + SetEnv("TERM", "xterm-kitty"); // 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.