mirror of
https://github.com/google/googletest.git
synced 2025-03-11 18:35:35 +00:00
Merge pull request #4490 from memdo:main
PiperOrigin-RevId: 616931521 Change-Id: Iffbb24e3f9add4e7acf8f1988a03afc8628b0733
This commit is contained in:
commit
eff443c6ef
@ -3270,6 +3270,7 @@ bool ShouldUseColor(bool stdout_is_tty) {
|
|||||||
term != nullptr && (String::CStringEquals(term, "xterm") ||
|
term != nullptr && (String::CStringEquals(term, "xterm") ||
|
||||||
String::CStringEquals(term, "xterm-color") ||
|
String::CStringEquals(term, "xterm-color") ||
|
||||||
String::CStringEquals(term, "xterm-kitty") ||
|
String::CStringEquals(term, "xterm-kitty") ||
|
||||||
|
String::CStringEquals(term, "alacritty") ||
|
||||||
String::CStringEquals(term, "screen") ||
|
String::CStringEquals(term, "screen") ||
|
||||||
String::CStringEquals(term, "tmux") ||
|
String::CStringEquals(term, "tmux") ||
|
||||||
String::CStringEquals(term, "rxvt-unicode") ||
|
String::CStringEquals(term, "rxvt-unicode") ||
|
||||||
@ -4437,8 +4438,8 @@ std::string XmlUnitTestResultPrinter::TestPropertiesAsXmlAttributes(
|
|||||||
Message attributes;
|
Message attributes;
|
||||||
for (int i = 0; i < result.test_property_count(); ++i) {
|
for (int i = 0; i < result.test_property_count(); ++i) {
|
||||||
const TestProperty& property = result.GetTestProperty(i);
|
const TestProperty& property = result.GetTestProperty(i);
|
||||||
attributes << " " << property.key() << "="
|
attributes << " " << property.key() << "=" << "\""
|
||||||
<< "\"" << EscapeXmlAttribute(property.value()) << "\"";
|
<< EscapeXmlAttribute(property.value()) << "\"";
|
||||||
}
|
}
|
||||||
return attributes.GetString();
|
return attributes.GetString();
|
||||||
}
|
}
|
||||||
@ -4748,9 +4749,7 @@ void JsonUnitTestResultPrinter::OutputJsonTestResult(::std::ostream* stream,
|
|||||||
if (part.failed()) {
|
if (part.failed()) {
|
||||||
*stream << ",\n";
|
*stream << ",\n";
|
||||||
if (++failures == 1) {
|
if (++failures == 1) {
|
||||||
*stream << kIndent << "\""
|
*stream << kIndent << "\"" << "failures" << "\": [\n";
|
||||||
<< "failures"
|
|
||||||
<< "\": [\n";
|
|
||||||
}
|
}
|
||||||
const std::string location =
|
const std::string location =
|
||||||
internal::FormatCompilerIndependentFileLocation(part.file_name(),
|
internal::FormatCompilerIndependentFileLocation(part.file_name(),
|
||||||
@ -4900,8 +4899,8 @@ std::string JsonUnitTestResultPrinter::TestPropertiesAsJson(
|
|||||||
for (int i = 0; i < result.test_property_count(); ++i) {
|
for (int i = 0; i < result.test_property_count(); ++i) {
|
||||||
const TestProperty& property = result.GetTestProperty(i);
|
const TestProperty& property = result.GetTestProperty(i);
|
||||||
attributes << ",\n"
|
attributes << ",\n"
|
||||||
<< indent << "\"" << property.key() << "\": "
|
<< indent << "\"" << property.key() << "\": " << "\""
|
||||||
<< "\"" << EscapeJson(property.value()) << "\"";
|
<< EscapeJson(property.value()) << "\"";
|
||||||
}
|
}
|
||||||
return attributes.GetString();
|
return attributes.GetString();
|
||||||
}
|
}
|
||||||
|
@ -80,6 +80,7 @@ class GTestColorTest(gtest_test_utils.TestCase):
|
|||||||
self.assertTrue(UsesColor('xterm', None, None))
|
self.assertTrue(UsesColor('xterm', None, None))
|
||||||
self.assertTrue(UsesColor('xterm-color', None, None))
|
self.assertTrue(UsesColor('xterm-color', None, None))
|
||||||
self.assertTrue(UsesColor('xterm-kitty', None, None))
|
self.assertTrue(UsesColor('xterm-kitty', None, None))
|
||||||
|
self.assertTrue(UsesColor('alacritty', None, None))
|
||||||
self.assertTrue(UsesColor('xterm-256color', None, None))
|
self.assertTrue(UsesColor('xterm-256color', None, None))
|
||||||
|
|
||||||
def testFlagOnly(self):
|
def testFlagOnly(self):
|
||||||
|
@ -4172,8 +4172,8 @@ TEST(AssertionSyntaxTest, ExceptionAssertionsBehavesLikeSingleStatement) {
|
|||||||
#endif
|
#endif
|
||||||
TEST(AssertionSyntaxTest, NoFatalFailureAssertionsBehavesLikeSingleStatement) {
|
TEST(AssertionSyntaxTest, NoFatalFailureAssertionsBehavesLikeSingleStatement) {
|
||||||
if (AlwaysFalse())
|
if (AlwaysFalse())
|
||||||
EXPECT_NO_FATAL_FAILURE(FAIL()) << "This should never be executed. "
|
EXPECT_NO_FATAL_FAILURE(FAIL())
|
||||||
<< "It's a compilation test only.";
|
<< "This should never be executed. " << "It's a compilation test only.";
|
||||||
else
|
else
|
||||||
; // NOLINT
|
; // NOLINT
|
||||||
|
|
||||||
@ -6671,6 +6671,9 @@ TEST(ColoredOutputTest, UsesColorsWhenTermSupportsColors) {
|
|||||||
SetEnv("TERM", "xterm-kitty"); // TERM supports colors.
|
SetEnv("TERM", "xterm-kitty"); // TERM supports colors.
|
||||||
EXPECT_TRUE(ShouldUseColor(true)); // Stdout is a TTY.
|
EXPECT_TRUE(ShouldUseColor(true)); // Stdout is a TTY.
|
||||||
|
|
||||||
|
SetEnv("TERM", "alacritty"); // TERM supports colors.
|
||||||
|
EXPECT_TRUE(ShouldUseColor(true)); // Stdout is a TTY.
|
||||||
|
|
||||||
SetEnv("TERM", "xterm-256color"); // TERM supports colors.
|
SetEnv("TERM", "xterm-256color"); // TERM supports colors.
|
||||||
EXPECT_TRUE(ShouldUseColor(true)); // Stdout is a TTY.
|
EXPECT_TRUE(ShouldUseColor(true)); // Stdout is a TTY.
|
||||||
|
|
||||||
@ -6695,7 +6698,7 @@ TEST(ColoredOutputTest, UsesColorsWhenTermSupportsColors) {
|
|||||||
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.
|
||||||
|
|
||||||
SetEnv("TERM", "cygwin"); // TERM supports colors.
|
SetEnv("TERM", "cygwin"); // TERM supports colors.
|
||||||
EXPECT_TRUE(ShouldUseColor(true)); // Stdout is a TTY.
|
EXPECT_TRUE(ShouldUseColor(true)); // Stdout is a TTY.
|
||||||
#endif // GTEST_OS_WINDOWS
|
#endif // GTEST_OS_WINDOWS
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user