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 |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 testRoundTripParsing(locale, aDate); | 244 testRoundTripParsing(locale, aDate); |
245 } | 245 } |
246 for (var hour in hours) { | 246 for (var hour in hours) { |
247 var aDate = new Date(2012, 1, 27, hour, 58, 59, 123); | 247 var aDate = new Date(2012, 1, 27, hour, 58, 59, 123); |
248 testRoundTripParsing(locale, aDate); | 248 testRoundTripParsing(locale, aDate); |
249 } | 249 } |
250 } | 250 } |
251 }); | 251 }); |
252 | 252 |
253 test('Patterns and symbols have the same coverage',() { | 253 test('Patterns and symbols have the same coverage',() { |
254 var patterns = new List.from(dateTimePatterns.getKeys()); | 254 var patterns = new List.from(dateTimePatterns.keys); |
255 var compare = (a, b) => a.compareTo(b); | 255 var compare = (a, b) => a.compareTo(b); |
256 patterns.sort(compare); | 256 patterns.sort(compare); |
257 var symbols = allLocales(); | 257 var symbols = allLocales(); |
258 // Workaround for a dartj2 issue that treats the keys as immutable | 258 // Workaround for a dartj2 issue that treats the keys as immutable |
259 symbols = new List.from(symbols); | 259 symbols = new List.from(symbols); |
260 symbols.sort(compare); | 260 symbols.sort(compare); |
261 for (var i = 0; i < patterns.length; i++) | 261 for (var i = 0; i < patterns.length; i++) |
262 expect(patterns[i], equals(symbols[i])); | 262 expect(patterns[i], equals(symbols[i])); |
263 expect(patterns.length, equals(symbols.length)); | 263 expect(patterns.length, equals(symbols.length)); |
264 }); | 264 }); |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 | 338 |
339 test('Test default format', () { | 339 test('Test default format', () { |
340 var someDate = new Date(2012, 1, 27, 20, 58, 59, 1); | 340 var someDate = new Date(2012, 1, 27, 20, 58, 59, 1); |
341 var emptyFormat = new DateFormat(null, "en_US"); | 341 var emptyFormat = new DateFormat(null, "en_US"); |
342 var knownDefault = new DateFormat.yMMMMd("en_US").add_jms(); | 342 var knownDefault = new DateFormat.yMMMMd("en_US").add_jms(); |
343 var result = emptyFormat.format(someDate); | 343 var result = emptyFormat.format(someDate); |
344 var knownResult = knownDefault.format(someDate); | 344 var knownResult = knownDefault.format(someDate); |
345 expect(result, knownResult); | 345 expect(result, knownResult); |
346 }); | 346 }); |
347 } | 347 } |
OLD | NEW |