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 /** | 5 /** |
6 * Tests the DateFormat library in dart. This file contains core tests that | 6 * Tests the DateFormat library in dart. This file contains core tests that |
7 * are run regardless of where the locale data is found, so it doesn't expect to | 7 * are run regardless of where the locale data is found, so it doesn't expect to |
8 * be run on its own, but rather to be imported and run from another test file. | 8 * be run on its own, but rather to be imported and run from another test file. |
9 */ | 9 */ |
10 | 10 |
11 #library('date_time_format_tests'); | 11 #library('date_time_format_tests'); |
12 | 12 |
| 13 // TODO(rnystrom): Use "package:" URL (#4968). |
13 #import('../date_format.dart'); | 14 #import('../date_format.dart'); |
14 #import('../../../pkg/unittest/unittest.dart'); | 15 #import('../../../pkg/unittest/lib/unittest.dart'); |
15 #import('date_time_format_test_data.dart'); | 16 #import('date_time_format_test_data.dart'); |
16 #import('../intl.dart'); | 17 #import('../intl.dart'); |
17 #import('../lib/date_format_internal.dart'); | 18 #import('../lib/date_format_internal.dart'); |
18 | 19 |
19 var formatsToTest = const [ | 20 var formatsToTest = const [ |
20 DateFormat.DAY, | 21 DateFormat.DAY, |
21 DateFormat.ABBR_WEEKDAY, | 22 DateFormat.ABBR_WEEKDAY, |
22 DateFormat.WEEKDAY, | 23 DateFormat.WEEKDAY, |
23 DateFormat.ABBR_STANDALONE_MONTH, | 24 DateFormat.ABBR_STANDALONE_MONTH, |
24 DateFormat.STANDALONE_MONTH, | 25 DateFormat.STANDALONE_MONTH, |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 var localPrinted = format.format(local); | 324 var localPrinted = format.format(local); |
324 var parsed = format.parse(localPrinted); | 325 var parsed = format.parse(localPrinted); |
325 var parsedUTC = format.parseUTC(format.format(utc)); | 326 var parsedUTC = format.parseUTC(format.format(utc)); |
326 var parsedOffset = parsedUTC.millisecondsSinceEpoch | 327 var parsedOffset = parsedUTC.millisecondsSinceEpoch |
327 - parsed.millisecondsSinceEpoch; | 328 - parsed.millisecondsSinceEpoch; |
328 expect(parsedOffset, equals(offset)); | 329 expect(parsedOffset, equals(offset)); |
329 expect(utc.hour, equals(parsedUTC.hour)); | 330 expect(utc.hour, equals(parsedUTC.hour)); |
330 expect(local.hour, equals(parsed.hour)); | 331 expect(local.hour, equals(parsed.hour)); |
331 }); | 332 }); |
332 } | 333 } |
OLD | NEW |