| 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 792 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 803 Expect.equals(DateTime.MONDAY, d.weekday); | 803 Expect.equals(DateTime.MONDAY, d.weekday); |
| 804 d = new DateTime(2011, 10, 2, 23, 45, 37, 0); | 804 d = new DateTime(2011, 10, 2, 23, 45, 37, 0); |
| 805 Expect.equals(DateTime.SUNDAY, d.weekday); | 805 Expect.equals(DateTime.SUNDAY, d.weekday); |
| 806 d = new DateTime(2011, 10, 1, 23, 45, 37, 0); | 806 d = new DateTime(2011, 10, 1, 23, 45, 37, 0); |
| 807 Expect.equals(DateTime.SATURDAY, d.weekday); | 807 Expect.equals(DateTime.SATURDAY, d.weekday); |
| 808 d = new DateTime(2011, 9, 30, 23, 45, 37, 0); | 808 d = new DateTime(2011, 9, 30, 23, 45, 37, 0); |
| 809 Expect.equals(DateTime.FRIDAY, d.weekday); | 809 Expect.equals(DateTime.FRIDAY, d.weekday); |
| 810 } | 810 } |
| 811 | 811 |
| 812 void testToStrings() { | 812 void testToStrings() { |
| 813 function test(date, time) { | 813 void test(date, time) { |
| 814 { // UTC time. | 814 { // UTC time. |
| 815 String source1 = "$date ${time}Z"; | 815 String source1 = "$date ${time}Z"; |
| 816 String source2 = "${date}T${time}Z"; | 816 String source2 = "${date}T${time}Z"; |
| 817 var utcTime1 = DateTime.parse(source1); | 817 var utcTime1 = DateTime.parse(source1); |
| 818 var utcTime2 = DateTime.parse(source1); | 818 var utcTime2 = DateTime.parse(source1); |
| 819 Expect.isTrue(utcTime1.isUtc); | 819 Expect.isTrue(utcTime1.isUtc); |
| 820 Expect.equals(utcTime1, utcTime2); | 820 Expect.equals(utcTime1, utcTime2); |
| 821 Expect.equals(source1, utcTime1.toString()); | 821 Expect.equals(source1, utcTime1.toString()); |
| 822 Expect.equals(source2, utcTime1.toIso8601String()); | 822 Expect.equals(source2, utcTime1.toIso8601String()); |
| 823 } | 823 } |
| (...skipping 23 matching lines...) Expand all Loading... |
| 847 testChangeTimeZone(); | 847 testChangeTimeZone(); |
| 848 testSubAdd(); | 848 testSubAdd(); |
| 849 testUnderflowAndOverflow(); | 849 testUnderflowAndOverflow(); |
| 850 testDateStrings(); | 850 testDateStrings(); |
| 851 testEquivalentYears(); | 851 testEquivalentYears(); |
| 852 testExtremes(); | 852 testExtremes(); |
| 853 testFarAwayDates(); | 853 testFarAwayDates(); |
| 854 testWeekday(); | 854 testWeekday(); |
| 855 testToStrings(); | 855 testToStrings(); |
| 856 } | 856 } |
| OLD | NEW |