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 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 */ | 177 */ |
178 List oddLocales() { | 178 List oddLocales() { |
179 int i = 1; | 179 int i = 1; |
180 return allLocales().where((x) => (i++).isOdd).toList(); | 180 return allLocales().where((x) => (i++).isOdd).toList(); |
181 } | 181 } |
182 | 182 |
183 /** | 183 /** |
184 * Return a set of a few locales to run just the tests on a small sample. | 184 * Return a set of a few locales to run just the tests on a small sample. |
185 */ | 185 */ |
186 List smallSetOfLocales() { | 186 List smallSetOfLocales() { |
187 return allLocales().getRange(0,10); | 187 return allLocales().sublist(0,10); |
188 } | 188 } |
189 | 189 |
190 /** | 190 /** |
191 * Return only the even-numbered locales. A simple way to divide the list into | 191 * Return only the even-numbered locales. A simple way to divide the list into |
192 * two roughly equal parts. | 192 * two roughly equal parts. |
193 */ | 193 */ |
194 List evenLocales() { | 194 List evenLocales() { |
195 int i = 1; | 195 int i = 1; |
196 return allLocales().where((x) => !((i++).isOdd)).toList(); | 196 return allLocales().where((x) => !((i++).isOdd)).toList(); |
197 } | 197 } |
(...skipping 157 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 |