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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« sdk/lib/core/date_time.dart ('K') | « sdk/lib/core/date_time.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 import "package:expect/expect.dart"; 5 import "package:expect/expect.dart";
6 6
7 // Dart test program for DateTime. 7 // Dart test program for DateTime.
8 8
9 // Identical to _MAX_MILLISECONDS_SINCE_EPOCH in date_time.dart 9 // Identical to _MAX_MILLISECONDS_SINCE_EPOCH in date_time.dart
10 const int _MAX_MILLISECONDS = 8640000000000000; 10 const int _MAX_MILLISECONDS = 8640000000000000;
(...skipping 914 matching lines...) Expand 10 before | Expand all | Expand 10 after
925 Expect.equals(source2, utcTime1.toIso8601String()); 925 Expect.equals(source2, utcTime1.toIso8601String());
926 } 926 }
927 } 927 }
928 test("2000-01-01", "12:00:00.000"); 928 test("2000-01-01", "12:00:00.000");
929 test("-2000-01-01", "12:00:00.000"); 929 test("-2000-01-01", "12:00:00.000");
930 test("1970-01-01", "00:00:00.000"); 930 test("1970-01-01", "00:00:00.000");
931 test("1969-12-31", "23:59:59.999"); 931 test("1969-12-31", "23:59:59.999");
932 test("1969-09-09", "00:09:09.009"); 932 test("1969-09-09", "00:09:09.009");
933 } 933 }
934 934
935 void testIsoString() {
936 var d = new DateTime(9999, 1, 1, 23, 59, 59, 999);
937 Expect.equals("9999-01-01T23:59:59.999", d.toIso8601String());
938 d = new DateTime(-9999, 1, 1, 23, 59, 59, 999);
939 Expect.equals("-9999-01-01T23:59:59.999", d.toIso8601String());
940 d = new DateTime.utc(9999, 1, 1, 23, 59, 59, 999);
941 Expect.equals("9999-01-01T23:59:59.999Z", d.toIso8601String());
942 d = new DateTime.utc(-9999, 1, 1, 23, 59, 59, 999);
943 Expect.equals("-9999-01-01T23:59:59.999Z", d.toIso8601String());
944
945 d = new DateTime(10000, 1, 1, 23, 59, 59, 999);
946 Expect.equals("+010000-01-01T23:59:59.999", d.toIso8601String());
947 d = new DateTime(-10000, 1, 1, 23, 59, 59, 999);
948 Expect.equals("-010000-01-01T23:59:59.999", d.toIso8601String());
949 d = new DateTime.utc(10000, 1, 1, 23, 59, 59, 999);
950 Expect.equals("+010000-01-01T23:59:59.999Z", d.toIso8601String());
951 d = new DateTime.utc(-10000, 1, 1, 23, 59, 59, 999);
952 Expect.equals("-010000-01-01T23:59:59.999Z", d.toIso8601String());
953 }
954
935 void main() { 955 void main() {
936 testNow(); 956 testNow();
937 testValue(); 957 testValue();
938 testConstructors(); 958 testConstructors();
939 testUTCGetters(); 959 testUTCGetters();
940 testLocalGetters(); 960 testLocalGetters();
941 testChangeTimeZone(); 961 testChangeTimeZone();
942 testSubAdd(); 962 testSubAdd();
943 testUnderflowAndOverflow(); 963 testUnderflowAndOverflow();
944 testDateStrings(); 964 testDateStrings();
945 testEquivalentYears(); 965 testEquivalentYears();
946 testExtremes(); 966 testExtremes();
947 testFarAwayDates(); 967 testFarAwayDates();
948 testWeekday(); 968 testWeekday();
949 testToStrings(); 969 testToStrings();
970 testIsoString();
950 } 971 }
OLDNEW
« 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