mirror of
https://github.com/dart-lang/sdk
synced 2024-10-14 08:51:21 +00:00
[tests] Removing more List constructor usage in corelib tests.
Change-Id: I4afac250d6646fbd08a661ea48f0927e9ccaea59 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142380 Commit-Queue: Riley Porter <rileyporter@google.com> Reviewed-by: Bob Nystrom <rnystrom@google.com>
This commit is contained in:
parent
db1172b075
commit
761e1f9b92
|
@ -70,7 +70,7 @@ main() {
|
|||
testCollection(new LinkedHashSet(), N);
|
||||
testCollection(new ListQueue(), N);
|
||||
testCollection(new DoubleLinkedQueue(), N);
|
||||
testList(new List()..length = N, N);
|
||||
testList(new List(N), N);
|
||||
testList([]..length = N, N);
|
||||
testList(new List.filled(N, null), N);
|
||||
testString(N);
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ class ExpandoTest {
|
|||
static testMain() {
|
||||
var legal = [
|
||||
new Object(),
|
||||
new List(),
|
||||
new List.filled(0, null),
|
||||
[1, 2, 3],
|
||||
const [1, 2, 3],
|
||||
new Map(),
|
||||
|
|
|
@ -15,8 +15,8 @@ test(list, notInList) {
|
|||
Expect.isFalse(list.contains(notInList), "!$list.contains($notInList)");
|
||||
}
|
||||
|
||||
List fixedList = new List(list.length);
|
||||
List growList = new List();
|
||||
List fixedList = new List.filled(list.length, null);
|
||||
List growList = [];
|
||||
for (int i = 0; i < list.length; i++) {
|
||||
fixedList[i] = list[i];
|
||||
growList.add(list[i]);
|
||||
|
|
|
@ -25,7 +25,7 @@ main() {
|
|||
for (dynamic iterable in [
|
||||
const [1, 2, 3],
|
||||
[1, 2, 3],
|
||||
new List(3)
|
||||
new List<int?>.filled(3, null)
|
||||
..[0] = 1
|
||||
..[1] = 2
|
||||
..[2] = 3,
|
||||
|
@ -86,7 +86,7 @@ main() {
|
|||
for (var iterable in [
|
||||
const [],
|
||||
[],
|
||||
new List(0),
|
||||
new List.empty(),
|
||||
{}.keys,
|
||||
{}.values,
|
||||
new Iterable.generate(0, (x) => x + 1),
|
||||
|
@ -116,7 +116,7 @@ main() {
|
|||
for (dynamic iterable in [
|
||||
const [1],
|
||||
[1],
|
||||
new List(1)..[0] = 1,
|
||||
new List.filled(1, 1),
|
||||
{1: 1}.keys,
|
||||
{1: 1}.values,
|
||||
new Iterable.generate(1, (x) => x + 1),
|
||||
|
|
|
@ -26,7 +26,7 @@ main() {
|
|||
for (dynamic iterable in [
|
||||
const [1, 2, 3],
|
||||
[1, 2, 3],
|
||||
new List(3)
|
||||
new List<int?>.filled(3, null)
|
||||
..[0] = 1
|
||||
..[1] = 2
|
||||
..[2] = 3,
|
||||
|
@ -88,7 +88,7 @@ main() {
|
|||
for (var iterable in [
|
||||
const [],
|
||||
[],
|
||||
new List(0),
|
||||
new List.empty(),
|
||||
{}.keys,
|
||||
{}.values,
|
||||
new Iterable.generate(0, (x) => x + 1),
|
||||
|
@ -119,7 +119,7 @@ main() {
|
|||
for (dynamic iterable in [
|
||||
const [1],
|
||||
[1],
|
||||
new List(1)..[0] = 1,
|
||||
new List.filled(1, 1),
|
||||
{1: 1}.keys,
|
||||
{1: 1}.values,
|
||||
new Iterable.generate(1, (x) => x + 1),
|
||||
|
|
|
@ -27,7 +27,7 @@ class SortHelper {
|
|||
}
|
||||
|
||||
void testSortIntLists() {
|
||||
var a = new List<int>(40);
|
||||
var a = new List<int>.filled(40, -1);
|
||||
|
||||
for (int i = 0; i < a.length; i++) {
|
||||
a[i] = i;
|
||||
|
@ -83,11 +83,10 @@ class SortHelper {
|
|||
a[33] = 1;
|
||||
testSort(a);
|
||||
|
||||
var a2 = new List<int>(0);
|
||||
var a2 = new List<int>.empty();
|
||||
testSort(a2);
|
||||
|
||||
var a3 = new List<int>(1);
|
||||
a3[0] = 1;
|
||||
var a3 = new List<int>.filled(1, 1);
|
||||
testSort(a3);
|
||||
|
||||
// --------
|
||||
|
@ -124,7 +123,7 @@ class SortHelper {
|
|||
}
|
||||
|
||||
void testInsertionSort(int i1, int i2, int i3, int i4) {
|
||||
var a = new List<int>(4);
|
||||
var a = new List<int>.filled(4, -1);
|
||||
a[0] = i1;
|
||||
a[1] = i2;
|
||||
a[2] = i3;
|
||||
|
@ -133,7 +132,7 @@ class SortHelper {
|
|||
}
|
||||
|
||||
void testSortDoubleLists() {
|
||||
var a = new List<double>(40);
|
||||
var a = new List<double>.filled(40, -1);
|
||||
for (int i = 0; i < a.length; i++) {
|
||||
a[i] = 1.0 * i + 0.5;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue