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

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

Issue 10537086: new Date.now() should be in local timezone. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 6 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 | « runtime/lib/date.dart ('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) 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();
11 bool timeMovedForward = false; 11 bool timeMovedForward = false;
12 for (int i = 0; i < 1000000; i++) { 12 for (int i = 0; i < 1000000; i++) {
13 var t2 = new Date.now(); 13 var t2 = new Date.now();
14 if (t1.value < t2.value) { 14 if (t1.value < t2.value) {
15 timeMovedForward = true; 15 timeMovedForward = true;
16 break; 16 break;
17 } 17 }
18 } 18 }
19 Expect.equals(true, timeMovedForward); 19 Expect.equals(true, timeMovedForward);
20 Expect.isFalse(t1.isUtc());
20 } 21 }
21 22
22 static void testValue() { 23 static void testValue() {
23 var dt1 = new Date.now(); 24 var dt1 = new Date.now();
24 var value = dt1.value; 25 var value = dt1.value;
25 var dt2 = new Date.fromEpoch(value); 26 var dt2 = new Date.fromEpoch(value);
26 Expect.equals(value, dt2.value); 27 Expect.equals(value, dt2.value);
27 } 28 }
28 29
29 static void testFarAwayDates() { 30 static void testFarAwayDates() {
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after
536 testDateStrings(); 537 testDateStrings();
537 testEquivalentYears(); 538 testEquivalentYears();
538 testFarAwayDates(); 539 testFarAwayDates();
539 testWeekday(); 540 testWeekday();
540 } 541 }
541 } 542 }
542 543
543 main() { 544 main() {
544 DateTest.testMain(); 545 DateTest.testMain();
545 } 546 }
OLDNEW
« no previous file with comments | « runtime/lib/date.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698