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

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

Issue 11770004: Rename Date to DateTime. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments and keep Backwards-compatibility class Date. Created 7 years, 11 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 | « tests/corelib/date_time4_test.dart ('k') | tests/corelib/date_time6_test.dart » ('j') | 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) 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 // Test Date constructor with optional arguments. 5 // Test DateTime constructor with optional arguments.
6 6
7 main() { 7 main() {
8 var d = new Date(2012); 8 var d = new DateTime(2012);
9 Expect.equals(2012, d.year); 9 Expect.equals(2012, d.year);
10 Expect.equals(1, d.month); 10 Expect.equals(1, d.month);
11 Expect.equals(1, d.day); 11 Expect.equals(1, d.day);
12 Expect.equals(0, d.hour); 12 Expect.equals(0, d.hour);
13 Expect.equals(0, d.minute); 13 Expect.equals(0, d.minute);
14 Expect.equals(0, d.second); 14 Expect.equals(0, d.second);
15 Expect.equals(0, d.millisecond); 15 Expect.equals(0, d.millisecond);
16 16
17 d = new Date(2012, 1, 28); 17 d = new DateTime(2012, 1, 28);
18 Expect.equals(2012, d.year); 18 Expect.equals(2012, d.year);
19 Expect.equals(1, d.month); 19 Expect.equals(1, d.month);
20 Expect.equals(28, d.day); 20 Expect.equals(28, d.day);
21 Expect.equals(0, d.hour); 21 Expect.equals(0, d.hour);
22 Expect.equals(0, d.minute); 22 Expect.equals(0, d.minute);
23 Expect.equals(0, d.second); 23 Expect.equals(0, d.second);
24 Expect.equals(0, d.millisecond); 24 Expect.equals(0, d.millisecond);
25 25
26 d = new Date(1970, 3); 26 d = new DateTime(1970, 3);
27 Expect.equals(1970, d.year); 27 Expect.equals(1970, d.year);
28 Expect.equals(3, d.month); 28 Expect.equals(3, d.month);
29 Expect.equals(1, d.day); 29 Expect.equals(1, d.day);
30 Expect.equals(0, d.hour); 30 Expect.equals(0, d.hour);
31 Expect.equals(0, d.minute); 31 Expect.equals(0, d.minute);
32 Expect.equals(0, d.second); 32 Expect.equals(0, d.second);
33 Expect.equals(0, d.millisecond); 33 Expect.equals(0, d.millisecond);
34 34
35 d = new Date(1970, 3, 1, 11); 35 d = new DateTime(1970, 3, 1, 11);
36 Expect.equals(1970, d.year); 36 Expect.equals(1970, d.year);
37 Expect.equals(3, d.month); 37 Expect.equals(3, d.month);
38 Expect.equals(1, d.day); 38 Expect.equals(1, d.day);
39 Expect.equals(11, d.hour); 39 Expect.equals(11, d.hour);
40 Expect.equals(0, d.minute); 40 Expect.equals(0, d.minute);
41 Expect.equals(0, d.second); 41 Expect.equals(0, d.second);
42 Expect.equals(0, d.millisecond); 42 Expect.equals(0, d.millisecond);
43 43
44 d = new Date(0, 12, 24, 0, 12); 44 d = new DateTime(0, 12, 24, 0, 12);
45 Expect.equals(0, d.year); 45 Expect.equals(0, d.year);
46 Expect.equals(12, d.month); 46 Expect.equals(12, d.month);
47 Expect.equals(24, d.day); 47 Expect.equals(24, d.day);
48 Expect.equals(0, d.hour); 48 Expect.equals(0, d.hour);
49 Expect.equals(12, d.minute); 49 Expect.equals(12, d.minute);
50 Expect.equals(0, d.second); 50 Expect.equals(0, d.second);
51 Expect.equals(0, d.millisecond); 51 Expect.equals(0, d.millisecond);
52 52
53 d = new Date(-1, 2, 2, 3, 0, 0, 4); 53 d = new DateTime(-1, 2, 2, 3, 0, 0, 4);
54 Expect.equals(-1, d.year); 54 Expect.equals(-1, d.year);
55 Expect.equals(2, d.month); 55 Expect.equals(2, d.month);
56 Expect.equals(2, d.day); 56 Expect.equals(2, d.day);
57 Expect.equals(3, d.hour); 57 Expect.equals(3, d.hour);
58 Expect.equals(0, d.minute); 58 Expect.equals(0, d.minute);
59 Expect.equals(0, d.second); 59 Expect.equals(0, d.second);
60 Expect.equals(4, d.millisecond); 60 Expect.equals(4, d.millisecond);
61 61
62 d = new Date(-1, 2, 2, 3, 0, 4); 62 d = new DateTime(-1, 2, 2, 3, 0, 4);
63 Expect.equals(-1, d.year); 63 Expect.equals(-1, d.year);
64 Expect.equals(2, d.month); 64 Expect.equals(2, d.month);
65 Expect.equals(2, d.day); 65 Expect.equals(2, d.day);
66 Expect.equals(3, d.hour); 66 Expect.equals(3, d.hour);
67 Expect.equals(0, d.minute); 67 Expect.equals(0, d.minute);
68 Expect.equals(4, d.second); 68 Expect.equals(4, d.second);
69 Expect.equals(0, d.millisecond); 69 Expect.equals(0, d.millisecond);
70 70
71 d = new Date(2012, 5, 15, 13, 21, 33, 12); 71 d = new DateTime(2012, 5, 15, 13, 21, 33, 12);
72 Expect.equals(2012, d.year); 72 Expect.equals(2012, d.year);
73 Expect.equals(5, d.month); 73 Expect.equals(5, d.month);
74 Expect.equals(15, d.day); 74 Expect.equals(15, d.day);
75 Expect.equals(13, d.hour); 75 Expect.equals(13, d.hour);
76 Expect.equals(21, d.minute); 76 Expect.equals(21, d.minute);
77 Expect.equals(33, d.second); 77 Expect.equals(33, d.second);
78 Expect.equals(12, d.millisecond); 78 Expect.equals(12, d.millisecond);
79 } 79 }
OLDNEW
« no previous file with comments | « tests/corelib/date_time4_test.dart ('k') | tests/corelib/date_time6_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698