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

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

Issue 2069783002: Fix Windows time zone name extraction. Update API docs (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Take daylight savings from call return. Restore previous failure return. Created 4 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
« sdk/lib/core/date_time.dart ('K') | « sdk/lib/core/date_time.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) 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 bool get supportsMicroseconds => 9 bool get supportsMicroseconds =>
10 new DateTime.fromMicrosecondsSinceEpoch(1).microsecondsSinceEpoch == 1; 10 new DateTime.fromMicrosecondsSinceEpoch(1).microsecondsSinceEpoch == 1;
(...skipping 1216 matching lines...) Expand 10 before | Expand all | Expand 10 after
1227 d = new DateTime(2011, 9, 30, 23, 45, 37, 0); 1227 d = new DateTime(2011, 9, 30, 23, 45, 37, 0);
1228 Expect.equals(DateTime.FRIDAY, d.weekday); 1228 Expect.equals(DateTime.FRIDAY, d.weekday);
1229 } 1229 }
1230 1230
1231 void testToStrings() { 1231 void testToStrings() {
1232 void test(date, time) { 1232 void test(date, time) {
1233 { // UTC time. 1233 { // UTC time.
1234 String source1 = "$date ${time}Z"; 1234 String source1 = "$date ${time}Z";
1235 String source2 = "${date}T${time}Z"; 1235 String source2 = "${date}T${time}Z";
1236 var utcTime1 = DateTime.parse(source1); 1236 var utcTime1 = DateTime.parse(source1);
1237 var utcTime2 = DateTime.parse(source1); 1237 var utcTime2 = DateTime.parse(source2);
1238 Expect.isTrue(utcTime1.isUtc); 1238 Expect.isTrue(utcTime1.isUtc);
1239 Expect.equals(utcTime1, utcTime2); 1239 Expect.equals(utcTime1, utcTime2);
1240 Expect.equals(source1, utcTime1.toString()); 1240 Expect.equals(source1, utcTime1.toString());
1241 Expect.equals(source2, utcTime1.toIso8601String()); 1241 Expect.equals(source2, utcTime1.toIso8601String());
1242 } 1242 }
1243 { // Local time 1243 { // Local time
1244 String source1 = "$date $time"; 1244 String source1 = "$date $time";
1245 String source2 = "${date}T$time"; 1245 String source2 = "${date}T$time";
1246 var utcTime1 = DateTime.parse(source1); 1246 var utcTime1 = DateTime.parse(source1);
1247 var utcTime2 = DateTime.parse(source1); 1247 var utcTime2 = DateTime.parse(source2);
1248 Expect.isFalse(utcTime1.isUtc); 1248 Expect.isFalse(utcTime1.isUtc);
1249 Expect.equals(utcTime1, utcTime2); 1249 Expect.equals(utcTime1, utcTime2);
1250 Expect.equals(source1, utcTime1.toString()); 1250 Expect.equals(source1, utcTime1.toString());
1251 Expect.equals(source2, utcTime1.toIso8601String()); 1251 Expect.equals(source2, utcTime1.toIso8601String());
1252 } 1252 }
1253 } 1253 }
1254 test("2000-01-01", "12:00:00.000"); 1254 test("2000-01-01", "12:00:00.000");
1255 test("-2000-01-01", "12:00:00.000"); 1255 test("-2000-01-01", "12:00:00.000");
1256 test("1970-01-01", "00:00:00.000"); 1256 test("1970-01-01", "00:00:00.000");
1257 test("1969-12-31", "23:59:59.999"); 1257 test("1969-12-31", "23:59:59.999");
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
1335 testSubAdd(); 1335 testSubAdd();
1336 testUnderflowAndOverflow(); 1336 testUnderflowAndOverflow();
1337 testDateStrings(); 1337 testDateStrings();
1338 testEquivalentYears(); 1338 testEquivalentYears();
1339 testExtremes(); 1339 testExtremes();
1340 testFarAwayDates(); 1340 testFarAwayDates();
1341 testWeekday(); 1341 testWeekday();
1342 testToStrings(); 1342 testToStrings();
1343 testIsoString(); 1343 testIsoString();
1344 } 1344 }
OLDNEW
« sdk/lib/core/date_time.dart ('K') | « sdk/lib/core/date_time.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698