Googletest export
Add millisecond precision to start timestamp in XML/JSON output - Previous timestamp had format YYYY-MM-DDThh:mm:ss, now YYYY-MM-DDThh:mm:ss.sss - This conforms to the ISO 8601 standard PiperOrigin-RevId: 329503623
This commit is contained in:
committed by
Mark Barolak
parent
df6b75949b
commit
af1e75ce0b
@@ -485,28 +485,28 @@ class FormatEpochTimeInMillisAsIso8601Test : public Test {
|
||||
const TimeInMillis FormatEpochTimeInMillisAsIso8601Test::kMillisPerSec;
|
||||
|
||||
TEST_F(FormatEpochTimeInMillisAsIso8601Test, PrintsTwoDigitSegments) {
|
||||
EXPECT_EQ("2011-10-31T18:52:42",
|
||||
EXPECT_EQ("2011-10-31T18:52:42.000",
|
||||
FormatEpochTimeInMillisAsIso8601(1320087162 * kMillisPerSec));
|
||||
}
|
||||
|
||||
TEST_F(FormatEpochTimeInMillisAsIso8601Test, MillisecondsDoNotAffectResult) {
|
||||
TEST_F(FormatEpochTimeInMillisAsIso8601Test, IncludesMillisecondsAfterDot) {
|
||||
EXPECT_EQ(
|
||||
"2011-10-31T18:52:42",
|
||||
"2011-10-31T18:52:42.234",
|
||||
FormatEpochTimeInMillisAsIso8601(1320087162 * kMillisPerSec + 234));
|
||||
}
|
||||
|
||||
TEST_F(FormatEpochTimeInMillisAsIso8601Test, PrintsLeadingZeroes) {
|
||||
EXPECT_EQ("2011-09-03T05:07:02",
|
||||
EXPECT_EQ("2011-09-03T05:07:02.000",
|
||||
FormatEpochTimeInMillisAsIso8601(1315026422 * kMillisPerSec));
|
||||
}
|
||||
|
||||
TEST_F(FormatEpochTimeInMillisAsIso8601Test, Prints24HourTime) {
|
||||
EXPECT_EQ("2011-09-28T17:08:22",
|
||||
EXPECT_EQ("2011-09-28T17:08:22.000",
|
||||
FormatEpochTimeInMillisAsIso8601(1317229702 * kMillisPerSec));
|
||||
}
|
||||
|
||||
TEST_F(FormatEpochTimeInMillisAsIso8601Test, PrintsEpochStart) {
|
||||
EXPECT_EQ("1970-01-01T00:00:00", FormatEpochTimeInMillisAsIso8601(0));
|
||||
EXPECT_EQ("1970-01-01T00:00:00.000", FormatEpochTimeInMillisAsIso8601(0));
|
||||
}
|
||||
|
||||
# ifdef __BORLANDC__
|
||||
|
||||
@@ -172,7 +172,7 @@ class GTestXMLTestCase(gtest_test_utils.TestCase):
|
||||
|
||||
if element.tagName in ('testsuites', 'testsuite', 'testcase'):
|
||||
timestamp = element.getAttributeNode('timestamp')
|
||||
timestamp.value = re.sub(r'^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d$',
|
||||
timestamp.value = re.sub(r'^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d\.\d\d\d$',
|
||||
'*', timestamp.value)
|
||||
if element.tagName in ('testsuites', 'testsuite', 'testcase'):
|
||||
time = element.getAttributeNode('time')
|
||||
|
||||
Reference in New Issue
Block a user