OLD | NEW |
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 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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( |
263 () => new Date.fromMillisecondsSinceEpoch(-8640000000000001)); | 263 () => new Date.fromMillisecondsSinceEpoch(-8640000000000001)); |
264 dt = new Date.fromMillisecondsSinceEpoch(8640000000000000); | 264 dt = new Date.fromMillisecondsSinceEpoch(8640000000000000); |
265 Expect.throws(() => new Date(dt.year, dt.month, dt.day, | 265 Expect.throws(() => new Date(dt.year, dt.month, dt.day, |
266 dt.hour, dt.minute, 0, 1)); | 266 dt.hour, dt.minute, 0, 1)); |
267 dt = new Date.fromMillisecondsSinceEpoch(-8640000000000000); | 267 dt = new Date.fromMillisecondsSinceEpoch(-8640000000000000, isUtc: true); |
268 Expect.throws(() => new Date(dt.year, dt.month, dt.day, | 268 Expect.throws(() => new Date(dt.year, dt.month, dt.day, |
269 dt.hour, dt.minute, 0, -1, isUtc: true)); | 269 dt.hour, dt.minute, 0, -1, isUtc: true)); |
270 } | 270 } |
271 | 271 |
272 static void testUTCGetters() { | 272 static void testUTCGetters() { |
273 var dt = new Date.fromMillisecondsSinceEpoch(1305140315000, isUtc: true); | 273 var dt = new Date.fromMillisecondsSinceEpoch(1305140315000, isUtc: true); |
274 Expect.equals(2011, dt.year); | 274 Expect.equals(2011, dt.year); |
275 Expect.equals(5, dt.month); | 275 Expect.equals(5, dt.month); |
276 Expect.equals(11, dt.day); | 276 Expect.equals(11, dt.day); |
277 Expect.equals(18, dt.hour); | 277 Expect.equals(18, dt.hour); |
(...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
816 testEquivalentYears(); | 816 testEquivalentYears(); |
817 testExtremes(); | 817 testExtremes(); |
818 testFarAwayDates(); | 818 testFarAwayDates(); |
819 testWeekday(); | 819 testWeekday(); |
820 } | 820 } |
821 } | 821 } |
822 | 822 |
823 main() { | 823 main() { |
824 DateTest.testMain(); | 824 DateTest.testMain(); |
825 } | 825 } |
OLD | NEW |