| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 481 Expect.equals(false, dt1.isUtc()); | 481 Expect.equals(false, dt1.isUtc()); |
| 482 dt1 = new Date.fromString("1999-01-02 23:58:59.99951Z"); | 482 dt1 = new Date.fromString("1999-01-02 23:58:59.99951Z"); |
| 483 Expect.equals(1999, dt1.year); | 483 Expect.equals(1999, dt1.year); |
| 484 Expect.equals(1, dt1.month); | 484 Expect.equals(1, dt1.month); |
| 485 Expect.equals(2, dt1.day); | 485 Expect.equals(2, dt1.day); |
| 486 Expect.equals(23, dt1.hours); | 486 Expect.equals(23, dt1.hours); |
| 487 Expect.equals(59, dt1.minutes); | 487 Expect.equals(59, dt1.minutes); |
| 488 Expect.equals(0, dt1.seconds); | 488 Expect.equals(0, dt1.seconds); |
| 489 Expect.equals(0, dt1.milliseconds); | 489 Expect.equals(0, dt1.milliseconds); |
| 490 Expect.equals(true, dt1.isUtc()); | 490 Expect.equals(true, dt1.isUtc()); |
| 491 dt1 = new Date.fromString("0009-09-09 09:09:09.009Z"); |
| 492 Expect.equals(9, dt1.year); |
| 493 Expect.equals(9, dt1.month); |
| 494 Expect.equals(9, dt1.day); |
| 495 Expect.equals(9, dt1.hours); |
| 496 Expect.equals(9, dt1.minutes); |
| 497 Expect.equals(9, dt1.seconds); |
| 498 Expect.equals(9, dt1.milliseconds); |
| 499 Expect.equals(true, dt1.isUtc()); |
| 491 } | 500 } |
| 492 | 501 |
| 493 static void testWeekday() { | 502 static void testWeekday() { |
| 494 // 2011-10-06 is Summertime. | 503 // 2011-10-06 is Summertime. |
| 495 var d = new Date(2011, 10, 6, 0, 45, 37, 0); | 504 var d = new Date(2011, 10, 6, 0, 45, 37, 0); |
| 496 Expect.equals(Date.THU, d.weekday); | 505 Expect.equals(Date.THU, d.weekday); |
| 497 d = new Date.withTimeZone(2011, 10, 6, 0, 45, 37, 0, const TimeZone.utc()); | 506 d = new Date.withTimeZone(2011, 10, 6, 0, 45, 37, 0, const TimeZone.utc()); |
| 498 Expect.equals(Date.THU, d.weekday); | 507 Expect.equals(Date.THU, d.weekday); |
| 499 d = new Date(2011, 10, 5, 23, 45, 37, 0); | 508 d = new Date(2011, 10, 5, 23, 45, 37, 0); |
| 500 Expect.equals(Date.WED, d.weekday); | 509 Expect.equals(Date.WED, d.weekday); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 533 testDateStrings(); | 542 testDateStrings(); |
| 534 testEquivalentYears(); | 543 testEquivalentYears(); |
| 535 testFarAwayDates(); | 544 testFarAwayDates(); |
| 536 testWeekday(); | 545 testWeekday(); |
| 537 } | 546 } |
| 538 } | 547 } |
| 539 | 548 |
| 540 main() { | 549 main() { |
| 541 DateTest.testMain(); | 550 DateTest.testMain(); |
| 542 } | 551 } |
| OLD | NEW |