| 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 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 expect(multiple1.format(date), equals(separateFormat)); | 211 expect(multiple1.format(date), equals(separateFormat)); |
| 212 var customPunctuation = new DateFormat("yMd").addPattern("jms",":::"); | 212 var customPunctuation = new DateFormat("yMd").addPattern("jms",":::"); |
| 213 var custom = "${separate1.format(date)}:::${separate2.format(date)}"; | 213 var custom = "${separate1.format(date)}:::${separate2.format(date)}"; |
| 214 expect(customPunctuation.format(date), equals(custom)); | 214 expect(customPunctuation.format(date), equals(custom)); |
| 215 }); | 215 }); |
| 216 | 216 |
| 217 test('Basic date format parsing', () { | 217 test('Basic date format parsing', () { |
| 218 var date_format = new DateFormat("d"); | 218 var date_format = new DateFormat("d"); |
| 219 expect( | 219 expect( |
| 220 date_format.parsePattern("hh:mm:ss") | 220 date_format.parsePattern("hh:mm:ss") |
| 221 .mappedBy((x) => x.pattern) | 221 .map((x) => x.pattern) |
| 222 .toList(), | 222 .toList(), |
| 223 orderedEquals(["hh",":", "mm",":","ss"])); | 223 orderedEquals(["hh",":", "mm",":","ss"])); |
| 224 expect( | 224 expect( |
| 225 date_format.parsePattern("hh:mm:ss") | 225 date_format.parsePattern("hh:mm:ss") |
| 226 .mappedBy((x) => x.pattern) | 226 .map((x) => x.pattern) |
| 227 .toList(), | 227 .toList(), |
| 228 orderedEquals(["hh",":", "mm",":","ss"])); | 228 orderedEquals(["hh",":", "mm",":","ss"])); |
| 229 }); | 229 }); |
| 230 | 230 |
| 231 test('Test ALL the supported formats on representative locales', () { | 231 test('Test ALL the supported formats on representative locales', () { |
| 232 var aDate = new DateTime(2012, 1, 27, 20, 58, 59, 0); | 232 var aDate = new DateTime(2012, 1, 27, 20, 58, 59, 0); |
| 233 testLocale("en_US", English, aDate); | 233 testLocale("en_US", English, aDate); |
| 234 if (subset.length > 1) { | 234 if (subset.length > 1) { |
| 235 // Don't run if we have just one locale, so some of these won't be there. | 235 // Don't run if we have just one locale, so some of these won't be there. |
| 236 testLocale("de_DE", German, aDate); | 236 testLocale("de_DE", German, aDate); |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 355 | 355 |
| 356 test('Test default format', () { | 356 test('Test default format', () { |
| 357 var someDate = new DateTime(2012, 1, 27, 20, 58, 59, 1); | 357 var someDate = new DateTime(2012, 1, 27, 20, 58, 59, 1); |
| 358 var emptyFormat = new DateFormat(null, "en_US"); | 358 var emptyFormat = new DateFormat(null, "en_US"); |
| 359 var knownDefault = new DateFormat.yMMMMd("en_US").add_jms(); | 359 var knownDefault = new DateFormat.yMMMMd("en_US").add_jms(); |
| 360 var result = emptyFormat.format(someDate); | 360 var result = emptyFormat.format(someDate); |
| 361 var knownResult = knownDefault.format(someDate); | 361 var knownResult = knownDefault.format(someDate); |
| 362 expect(result, knownResult); | 362 expect(result, knownResult); |
| 363 }); | 363 }); |
| 364 } | 364 } |
| OLD | NEW |