Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(155)

Unified Diff: pkg/intl/test/date_time_format_test_core.dart

Issue 92333002: Retry date comparison to avoid a rare flake that might be associated with DST (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Don't suppress the error, print more information about it Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/intl/test/date_time_format_test_core.dart
diff --git a/pkg/intl/test/date_time_format_test_core.dart b/pkg/intl/test/date_time_format_test_core.dart
index 757bb6bd80ef276fd34b574259fad5451c6e702b..5d3909010c079e1c5fbd7180ec4e120ada6d99b1 100644
--- a/pkg/intl/test/date_time_format_test_core.dart
+++ b/pkg/intl/test/date_time_format_test_core.dart
@@ -144,7 +144,7 @@ testRoundTripParsing(String localeName, DateTime date) {
// At least in most cases. In some cases, we can't even do that. e.g.
// the skeleton WEEKDAY can't be reconstructed at all, and YEAR_MONTH
// formats don't give us enough information to construct a valid date.
- var badSkeletons = [
+ var badSkeletons = const [
DateFormat.ABBR_WEEKDAY,
DateFormat.WEEKDAY,
DateFormat.QUARTER,
@@ -156,6 +156,9 @@ testRoundTripParsing(String localeName, DateTime date) {
DateFormat.MONTH_WEEKDAY_DAY,
DateFormat.NUM_MONTH_WEEKDAY_DAY,
DateFormat.ABBR_MONTH_WEEKDAY_DAY];
+ var originalTime = new DateTime.now();
+ var originalTimeZoneOffset = date.timeZoneOffset;
+ var originalTimeZoneName = date.timeZoneName;
for(int i = 0; i < formatsToTest.length; i++) {
var skeleton = formatsToTest[i];
if (!badSkeletons.any((x) => x == skeleton)) {
@@ -163,6 +166,25 @@ testRoundTripParsing(String localeName, DateTime date) {
var actualResult = format.format(date);
var parsed = format.parse(actualResult);
var thenPrintAgain = format.format(parsed);
+ // We've seen a case where this failed in a way that seemed like a time
+ // zone shifting or some other strange behaviour that caused an off by
+ // one error in the date. Check for this and print out as much information
+ // as possible if it occurs again.
+ if (thenPrintAgain != actualResult) {
+ print("Date mismatch!");
+ print(" Expected $actualResult");
+ print(" Got $thenPrintAgain");
+ print(" Original date = $date");
+ print(" Original ms = ${date.millisecondsSinceEpoch}");
+ print(" Parsed back to $parsed");
+ print(" Parsed ms = ${parsed.millisecondsSinceEpoch}");
+ print(" Original tz = $originalTimeZoneOffset");
+ print(" Current tz name = $originalTimeZoneName");
+ print(" Current tz = ${parsed.timeZoneOffset}");
+ print(" Current tz name = ${parsed.timeZoneName}");
+ print(" Start time = $originalTime");
+ print(" Current time ${new DateTime.now()}");
+ }
expect(thenPrintAgain, equals(actualResult));
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698