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

Side by Side Diff: tests/corelib/date_time_test.dart

Issue 10920010: Check if the decomposed date is in the correct range. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 3 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
« no previous file with comments | « tests/corelib/corelib.status ('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 // Dart test program for Date. 5 // Dart test program for Date.
6 6
7 class DateTest { 7 class DateTest {
8 // Tests if the time moves eventually forward. 8 // Tests if the time moves eventually forward.
9 static void testNow() { 9 static void testNow() {
10 var t1 = new Date.now(); 10 var t1 = new Date.now();
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 dt = new Date(dt.year, dt.month, dt.day, dt.hour, dt.minute); 252 dt = new Date(dt.year, dt.month, dt.day, dt.hour, dt.minute);
253 Expect.equals(8640000000000000, dt.millisecondsSinceEpoch); 253 Expect.equals(8640000000000000, dt.millisecondsSinceEpoch);
254 dt = new Date.fromMillisecondsSinceEpoch(-8640000000000000); 254 dt = new Date.fromMillisecondsSinceEpoch(-8640000000000000);
255 dt = new Date(dt.year, dt.month, dt.day, dt.hour, dt.minute); 255 dt = new Date(dt.year, dt.month, dt.day, dt.hour, dt.minute);
256 Expect.equals(-8640000000000000, dt.millisecondsSinceEpoch); 256 Expect.equals(-8640000000000000, dt.millisecondsSinceEpoch);
257 Expect.throws(() => new Date.fromMillisecondsSinceEpoch(8640000000000001, 257 Expect.throws(() => new Date.fromMillisecondsSinceEpoch(8640000000000001,
258 isUtc: true)); 258 isUtc: true));
259 Expect.throws(() => new Date.fromMillisecondsSinceEpoch(-8640000000000001, 259 Expect.throws(() => new Date.fromMillisecondsSinceEpoch(-8640000000000001,
260 isUtc: true)); 260 isUtc: true));
261 Expect.throws(() => new Date.fromMillisecondsSinceEpoch(8640000000000001)); 261 Expect.throws(() => new Date.fromMillisecondsSinceEpoch(8640000000000001));
262 Expect.throws( 262 Expect.throws(() => new Date.fromMillisecondsSinceEpoch(-8640000000000001));
263 () => new Date.fromMillisecondsSinceEpoch(-8640000000000001));
264 dt = new Date.fromMillisecondsSinceEpoch(8640000000000000); 263 dt = new Date.fromMillisecondsSinceEpoch(8640000000000000);
265 Expect.throws(() => new Date(dt.year, dt.month, dt.day, 264 Expect.throws(() => new Date(dt.year, dt.month, dt.day,
266 dt.hour, dt.minute, 0, 1)); 265 dt.hour, dt.minute, 0, 1));
266 dt = new Date.fromMillisecondsSinceEpoch(8640000000000000, isUtc: true);
267 Expect.throws(() => new Date(dt.year, dt.month, dt.day,
268 dt.hour, dt.minute, 0, 1, isUtc: true));
269 dt = new Date.fromMillisecondsSinceEpoch(-8640000000000000);
270 Expect.throws(() => new Date(dt.year, dt.month, dt.day,
271 dt.hour, dt.minute, 0, -1));
267 dt = new Date.fromMillisecondsSinceEpoch(-8640000000000000, isUtc: true); 272 dt = new Date.fromMillisecondsSinceEpoch(-8640000000000000, isUtc: true);
268 Expect.throws(() => new Date(dt.year, dt.month, dt.day, 273 Expect.throws(() => new Date(dt.year, dt.month, dt.day,
269 dt.hour, dt.minute, 0, -1, isUtc: true)); 274 dt.hour, dt.minute, 0, -1, isUtc: true));
270 } 275 }
271 276
272 static void testUTCGetters() { 277 static void testUTCGetters() {
273 var dt = new Date.fromMillisecondsSinceEpoch(1305140315000, isUtc: true); 278 var dt = new Date.fromMillisecondsSinceEpoch(1305140315000, isUtc: true);
274 Expect.equals(2011, dt.year); 279 Expect.equals(2011, dt.year);
275 Expect.equals(5, dt.month); 280 Expect.equals(5, dt.month);
276 Expect.equals(11, dt.day); 281 Expect.equals(11, dt.day);
(...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after
816 testEquivalentYears(); 821 testEquivalentYears();
817 testExtremes(); 822 testExtremes();
818 testFarAwayDates(); 823 testFarAwayDates();
819 testWeekday(); 824 testWeekday();
820 } 825 }
821 } 826 }
822 827
823 main() { 828 main() {
824 DateTest.testMain(); 829 DateTest.testMain();
825 } 830 }
OLDNEW
« no previous file with comments | « tests/corelib/corelib.status ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698