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

Unified Diff: tests/corelib/date_time_test.dart

Issue 629943002: Document DateTime.parse accepted format. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add test, fix bug. Created 6 years, 2 months 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
« sdk/lib/core/date_time.dart ('K') | « sdk/lib/core/date_time.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/corelib/date_time_test.dart
diff --git a/tests/corelib/date_time_test.dart b/tests/corelib/date_time_test.dart
index 06d28d2cebecf4292043e60ecd053ae4142be852..62c8ab880b7445fc75edf84a0f3e3ada472d5013 100644
--- a/tests/corelib/date_time_test.dart
+++ b/tests/corelib/date_time_test.dart
@@ -932,6 +932,26 @@ void testToStrings() {
test("1969-09-09", "00:09:09.009");
}
+void testIsoString() {
+ var d = new DateTime(9999, 1, 1, 23, 59, 59, 999);
+ Expect.equals("9999-01-01T23:59:59.999", d.toIso8601String());
+ d = new DateTime(-9999, 1, 1, 23, 59, 59, 999);
+ Expect.equals("-9999-01-01T23:59:59.999", d.toIso8601String());
+ d = new DateTime.utc(9999, 1, 1, 23, 59, 59, 999);
+ Expect.equals("9999-01-01T23:59:59.999Z", d.toIso8601String());
+ d = new DateTime.utc(-9999, 1, 1, 23, 59, 59, 999);
+ Expect.equals("-9999-01-01T23:59:59.999Z", d.toIso8601String());
+
+ d = new DateTime(10000, 1, 1, 23, 59, 59, 999);
+ Expect.equals("+010000-01-01T23:59:59.999", d.toIso8601String());
+ d = new DateTime(-10000, 1, 1, 23, 59, 59, 999);
+ Expect.equals("-010000-01-01T23:59:59.999", d.toIso8601String());
+ d = new DateTime.utc(10000, 1, 1, 23, 59, 59, 999);
+ Expect.equals("+010000-01-01T23:59:59.999Z", d.toIso8601String());
+ d = new DateTime.utc(-10000, 1, 1, 23, 59, 59, 999);
+ Expect.equals("-010000-01-01T23:59:59.999Z", d.toIso8601String());
+}
+
void main() {
testNow();
testValue();
@@ -947,4 +967,5 @@ void main() {
testFarAwayDates();
testWeekday();
testToStrings();
+ testIsoString();
}
« sdk/lib/core/date_time.dart ('K') | « sdk/lib/core/date_time.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698