| 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 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 // Tests if the time moves eventually forward. | 9 // Tests if the time moves eventually forward. |
| 10 void testNow() { | 10 void testNow() { |
| (...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 601 dtBase1.minute, dtBase1.second, dtBase1.millisecond); | 601 dtBase1.minute, dtBase1.second, dtBase1.millisecond); |
| 602 Expect.equals(dtBase1.year - 2, dtTick.year); | 602 Expect.equals(dtBase1.year - 2, dtTick.year); |
| 603 Expect.equals(dtBase1.month, dtTick.month); | 603 Expect.equals(dtBase1.month, dtTick.month); |
| 604 Expect.equals(dtBase1.day, dtTick.day); | 604 Expect.equals(dtBase1.day, dtTick.day); |
| 605 Expect.equals(dtBase1.hour, dtTick.hour); | 605 Expect.equals(dtBase1.hour, dtTick.hour); |
| 606 Expect.equals(dtBase1.minute, dtTick.minute); | 606 Expect.equals(dtBase1.minute, dtTick.minute); |
| 607 Expect.equals(dtBase1.second, dtTick.second); | 607 Expect.equals(dtBase1.second, dtTick.second); |
| 608 Expect.equals(dtBase1.millisecond, dtTick.millisecond); | 608 Expect.equals(dtBase1.millisecond, dtTick.millisecond); |
| 609 } | 609 } |
| 610 | 610 |
| 611 static void testDateStrings() { | 611 void testDateStrings() { |
| 612 // TODO(floitsch): Clean up the DateTime API that deals with strings. | 612 // TODO(floitsch): Clean up the DateTime API that deals with strings. |
| 613 var dt1 = DateTime.parse("2011-05-11 18:58:35Z"); | 613 var dt1 = DateTime.parse("2011-05-11 18:58:35Z"); |
| 614 Expect.equals(1305140315000, dt1.millisecondsSinceEpoch); | 614 Expect.equals(1305140315000, dt1.millisecondsSinceEpoch); |
| 615 Expect.isTrue(dt1.isUtc); | 615 Expect.isTrue(dt1.isUtc); |
| 616 dt1 = DateTime.parse("20110511 18:58:35z"); | 616 dt1 = DateTime.parse("20110511 18:58:35z"); |
| 617 Expect.equals(1305140315000, dt1.millisecondsSinceEpoch); | 617 Expect.equals(1305140315000, dt1.millisecondsSinceEpoch); |
| 618 Expect.isTrue(dt1.isUtc); | 618 Expect.isTrue(dt1.isUtc); |
| 619 dt1 = DateTime.parse("+20110511 18:58:35z"); | 619 dt1 = DateTime.parse("+20110511 18:58:35z"); |
| 620 Expect.equals(1305140315000, dt1.millisecondsSinceEpoch); | 620 Expect.equals(1305140315000, dt1.millisecondsSinceEpoch); |
| 621 Expect.isTrue(dt1.isUtc); | 621 Expect.isTrue(dt1.isUtc); |
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 919 testChangeTimeZone(); | 919 testChangeTimeZone(); |
| 920 testSubAdd(); | 920 testSubAdd(); |
| 921 testUnderflowAndOverflow(); | 921 testUnderflowAndOverflow(); |
| 922 testDateStrings(); | 922 testDateStrings(); |
| 923 testEquivalentYears(); | 923 testEquivalentYears(); |
| 924 testExtremes(); | 924 testExtremes(); |
| 925 testFarAwayDates(); | 925 testFarAwayDates(); |
| 926 testWeekday(); | 926 testWeekday(); |
| 927 testToStrings(); | 927 testToStrings(); |
| 928 } | 928 } |
| OLD | NEW |