From 005254dae2c0fc311abf4736ca7ec8fc62ec20f7 Mon Sep 17 00:00:00 2001 From: Hector Dearman Date: Fri, 10 Jan 2025 15:37:52 +0000 Subject: [PATCH] Default to color output for ghostty --- 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 3c1cac6e..82e1eb44 100644 --- a/googletest/src/gtest.cc +++ b/googletest/src/gtest.cc @@ -3287,6 +3287,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-ghostty") || String::CStringEquals(term, "xterm-kitty") || String::CStringEquals(term, "alacritty") || String::CStringEquals(term, "screen") || diff --git a/googletest/test/googletest-color-test.py b/googletest/test/googletest-color-test.py index 8968cf1f..76ca8e0c 100755 --- a/googletest/test/googletest-color-test.py +++ b/googletest/test/googletest-color-test.py @@ -79,6 +79,7 @@ class GTestColorTest(gtest_test_utils.TestCase): self.assertTrue(UsesColor('cygwin', None, None)) self.assertTrue(UsesColor('xterm', None, None)) self.assertTrue(UsesColor('xterm-color', None, None)) + self.assertTrue(UsesColor('xterm-ghostty', None, None)) self.assertTrue(UsesColor('xterm-kitty', None, None)) self.assertTrue(UsesColor('alacritty', None, None)) self.assertTrue(UsesColor('xterm-256color', None, None)) diff --git a/googletest/test/gtest_unittest.cc b/googletest/test/gtest_unittest.cc index 2d48deef..1b605485 100644 --- a/googletest/test/gtest_unittest.cc +++ b/googletest/test/gtest_unittest.cc @@ -6717,6 +6717,9 @@ TEST(ColoredOutputTest, UsesColorsWhenTermSupportsColors) { SetEnv("TERM", "xterm-color"); // TERM supports colors. EXPECT_TRUE(ShouldUseColor(true)); // Stdout is a TTY. + SetEnv("TERM", "xterm-ghostty"); // 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.