Skip to content

Commit eff443c

Browse files
Merge pull request #4490 from memdo:main
PiperOrigin-RevId: 616931521 Change-Id: Iffbb24e3f9add4e7acf8f1988a03afc8628b0733
2 parents c231e6f + a1a6083 commit eff443c

File tree

3 files changed

+13
-10
lines changed

3 files changed

+13
-10
lines changed

googletest/src/gtest.cc

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3270,6 +3270,7 @@ bool ShouldUseColor(bool stdout_is_tty) {
32703270
term != nullptr && (String::CStringEquals(term, "xterm") ||
32713271
String::CStringEquals(term, "xterm-color") ||
32723272
String::CStringEquals(term, "xterm-kitty") ||
3273+
String::CStringEquals(term, "alacritty") ||
32733274
String::CStringEquals(term, "screen") ||
32743275
String::CStringEquals(term, "tmux") ||
32753276
String::CStringEquals(term, "rxvt-unicode") ||
@@ -4437,8 +4438,8 @@ std::string XmlUnitTestResultPrinter::TestPropertiesAsXmlAttributes(
44374438
Message attributes;
44384439
for (int i = 0; i < result.test_property_count(); ++i) {
44394440
const TestProperty& property = result.GetTestProperty(i);
4440-
attributes << " " << property.key() << "="
4441-
<< "\"" << EscapeXmlAttribute(property.value()) << "\"";
4441+
attributes << " " << property.key() << "=" << "\""
4442+
<< EscapeXmlAttribute(property.value()) << "\"";
44424443
}
44434444
return attributes.GetString();
44444445
}
@@ -4748,9 +4749,7 @@ void JsonUnitTestResultPrinter::OutputJsonTestResult(::std::ostream* stream,
47484749
if (part.failed()) {
47494750
*stream << ",\n";
47504751
if (++failures == 1) {
4751-
*stream << kIndent << "\""
4752-
<< "failures"
4753-
<< "\": [\n";
4752+
*stream << kIndent << "\"" << "failures" << "\": [\n";
47544753
}
47554754
const std::string location =
47564755
internal::FormatCompilerIndependentFileLocation(part.file_name(),
@@ -4900,8 +4899,8 @@ std::string JsonUnitTestResultPrinter::TestPropertiesAsJson(
49004899
for (int i = 0; i < result.test_property_count(); ++i) {
49014900
const TestProperty& property = result.GetTestProperty(i);
49024901
attributes << ",\n"
4903-
<< indent << "\"" << property.key() << "\": "
4904-
<< "\"" << EscapeJson(property.value()) << "\"";
4902+
<< indent << "\"" << property.key() << "\": " << "\""
4903+
<< EscapeJson(property.value()) << "\"";
49054904
}
49064905
return attributes.GetString();
49074906
}

googletest/test/googletest-color-test.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ def testNoEnvVarNoFlag(self):
8080
self.assertTrue(UsesColor('xterm', None, None))
8181
self.assertTrue(UsesColor('xterm-color', None, None))
8282
self.assertTrue(UsesColor('xterm-kitty', None, None))
83+
self.assertTrue(UsesColor('alacritty', None, None))
8384
self.assertTrue(UsesColor('xterm-256color', None, None))
8485

8586
def testFlagOnly(self):

googletest/test/gtest_unittest.cc

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4172,8 +4172,8 @@ TEST(AssertionSyntaxTest, ExceptionAssertionsBehavesLikeSingleStatement) {
41724172
#endif
41734173
TEST(AssertionSyntaxTest, NoFatalFailureAssertionsBehavesLikeSingleStatement) {
41744174
if (AlwaysFalse())
4175-
EXPECT_NO_FATAL_FAILURE(FAIL()) << "This should never be executed. "
4176-
<< "It's a compilation test only.";
4175+
EXPECT_NO_FATAL_FAILURE(FAIL())
4176+
<< "This should never be executed. " << "It's a compilation test only.";
41774177
else
41784178
; // NOLINT
41794179

@@ -6671,6 +6671,9 @@ TEST(ColoredOutputTest, UsesColorsWhenTermSupportsColors) {
66716671
SetEnv("TERM", "xterm-kitty"); // TERM supports colors.
66726672
EXPECT_TRUE(ShouldUseColor(true)); // Stdout is a TTY.
66736673

6674+
SetEnv("TERM", "alacritty"); // TERM supports colors.
6675+
EXPECT_TRUE(ShouldUseColor(true)); // Stdout is a TTY.
6676+
66746677
SetEnv("TERM", "xterm-256color"); // TERM supports colors.
66756678
EXPECT_TRUE(ShouldUseColor(true)); // Stdout is a TTY.
66766679

@@ -6695,7 +6698,7 @@ TEST(ColoredOutputTest, UsesColorsWhenTermSupportsColors) {
66956698
SetEnv("TERM", "linux"); // TERM supports colors.
66966699
EXPECT_TRUE(ShouldUseColor(true)); // Stdout is a TTY.
66976700

6698-
SetEnv("TERM", "cygwin"); // TERM supports colors.
6701+
SetEnv("TERM", "cygwin"); // TERM supports colors.
66996702
EXPECT_TRUE(ShouldUseColor(true)); // Stdout is a TTY.
67006703
#endif // GTEST_OS_WINDOWS
67016704
}

0 commit comments

Comments
 (0)