mirror of
https://github.com/dart-lang/sdk
synced 2024-10-14 09:31:58 +00:00
[tests] Clean up List constructor usage and unused multi-test
Split out int64 lines of multi-test for corelib/iterable_return_type_test and added status to skip the int64 test on the web compilers. Change-Id: I1e56299973956932c5b16b1ceeeb2b8f00457bf5 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/141802 Reviewed-by: Bob Nystrom <rnystrom@google.com> Commit-Queue: Riley Porter <rileyporter@google.com>
This commit is contained in:
parent
99a5117411
commit
b9d35ded2e
|
@ -31,8 +31,9 @@ regexp/pcre_test: Slow, Pass # Issue 21593
|
|||
*: SkipByDesign
|
||||
|
||||
[ $runtime != none && ($compiler == dart2js || $compiler == dartdevc || $compiler == dartdevk) ]
|
||||
int_parse_with_limited_ints_test: Skip # Requires fixed-size int64 support.
|
||||
typed_data_with_limited_ints_test: Skip # Requires fixed-size int64 support.
|
||||
int_parse_with_limited_ints_test: SkipByDesign # Requires fixed-size int64 support.
|
||||
iterable_return_type_int64_test: SkipByDesign # Requires int64 support.
|
||||
typed_data_with_limited_ints_test: SkipByDesign # Requires fixed-size int64 support.
|
||||
|
||||
[ $arch == simarm || $arch == simarm64 ]
|
||||
bigint_parse_radix_test: Skip # Issue 31659
|
||||
|
@ -41,8 +42,6 @@ bigint_test: Skip # Issue 31659
|
|||
[ $compiler == dartdevc || $compiler == dartdevk ]
|
||||
bigint_test/03: SkipSlow # modPow is very slow
|
||||
bigint_test/15: SkipSlow # modPow is very slow
|
||||
int_parse_with_limited_ints_test: Skip # Requires fixed-size int64 support.
|
||||
typed_data_with_limited_ints_test: Skip # Requires fixed-size int64 support.
|
||||
uri_parse_test: Slow, Pass
|
||||
uri_test: Slow, Pass
|
||||
|
||||
|
|
43
tests/corelib/iterable_return_type_helper.dart
Normal file
43
tests/corelib/iterable_return_type_helper.dart
Normal file
|
@ -0,0 +1,43 @@
|
|||
// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
|
||||
// for details. All rights reserved. Use of this source code is governed by a
|
||||
// BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
import "package:expect/expect.dart";
|
||||
|
||||
testIntIterable(iterable) {
|
||||
Expect.isTrue(iterable is Iterable<int>, "${iterable.runtimeType}");
|
||||
Expect.isFalse(iterable is Iterable<String>, "${iterable.runtimeType}");
|
||||
}
|
||||
|
||||
void testIterable(Iterable<int> iterable, [int depth = 3]) {
|
||||
testIntIterable(iterable);
|
||||
if (depth > 0) {
|
||||
testIterable(iterable.where((x) => true), depth - 1);
|
||||
testIterable(iterable.skip(1), depth - 1);
|
||||
testIterable(iterable.take(1), depth - 1);
|
||||
testIterable(iterable.skipWhile((x) => false), depth - 1);
|
||||
testIterable(iterable.takeWhile((x) => true), depth - 1);
|
||||
testList(iterable.toList(growable: true), depth - 1);
|
||||
testList(iterable.toList(growable: false), depth - 1);
|
||||
testIterable(iterable.toSet(), depth - 1);
|
||||
}
|
||||
}
|
||||
|
||||
void testList(List<int> list, [int depth = 3]) {
|
||||
testIterable(list, depth);
|
||||
if (depth > 0) {
|
||||
testIterable(list.getRange(0, list.length), depth - 1);
|
||||
testIterable(list.reversed, depth - 1);
|
||||
testMap(list.asMap(), depth - 1);
|
||||
}
|
||||
}
|
||||
|
||||
void testMap(Map<int, int> map, [int depth = 3]) {
|
||||
Expect.isTrue(map is Map<int, int>);
|
||||
Expect.isFalse(map is Map<int, String>);
|
||||
Expect.isFalse(map is Map<String, int>);
|
||||
if (depth > 0) {
|
||||
testIterable(map.keys, depth - 1);
|
||||
testIterable(map.values, depth - 1);
|
||||
}
|
||||
}
|
16
tests/corelib/iterable_return_type_int64_test.dart
Normal file
16
tests/corelib/iterable_return_type_int64_test.dart
Normal file
|
@ -0,0 +1,16 @@
|
|||
// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
|
||||
// for details. All rights reserved. Use of this source code is governed by a
|
||||
// BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
// Separate test for int64 support to be skipped on the web.
|
||||
|
||||
import 'iterable_return_type_helper.dart';
|
||||
|
||||
import 'dart:collection';
|
||||
import 'dart:typed_data';
|
||||
|
||||
main() {
|
||||
// Types for int64 support
|
||||
testList(new Uint64List(1)..[0] = 1);
|
||||
testList(new Int64List(1)..[0] = 1);
|
||||
}
|
|
@ -5,72 +5,30 @@
|
|||
// Regression test for dart2js where [List.addAll] was not typed
|
||||
// correctly.
|
||||
|
||||
import "package:expect/expect.dart";
|
||||
import 'iterable_return_type_helper.dart';
|
||||
|
||||
import 'dart:collection';
|
||||
import 'dart:typed_data';
|
||||
|
||||
testIntIterable(iterable) {
|
||||
Expect.isTrue(iterable is Iterable<int>, "${iterable.runtimeType}");
|
||||
Expect.isFalse(iterable is Iterable<String>, "${iterable.runtimeType}");
|
||||
}
|
||||
|
||||
void testIterable(Iterable<int> iterable, [int depth = 3]) {
|
||||
testIntIterable(iterable);
|
||||
if (depth > 0) {
|
||||
testIterable(iterable.where((x) => true), depth - 1);
|
||||
testIterable(iterable.skip(1), depth - 1);
|
||||
testIterable(iterable.take(1), depth - 1);
|
||||
testIterable(iterable.skipWhile((x) => false), depth - 1);
|
||||
testIterable(iterable.takeWhile((x) => true), depth - 1);
|
||||
testList(iterable.toList(growable: true), depth - 1);
|
||||
testList(iterable.toList(growable: false), depth - 1);
|
||||
testIterable(iterable.toSet(), depth - 1);
|
||||
}
|
||||
}
|
||||
|
||||
void testList(List<int> list, [int depth = 3]) {
|
||||
testIterable(list, depth);
|
||||
if (depth > 0) {
|
||||
testIterable(list.getRange(0, list.length), depth - 1);
|
||||
testIterable(list.reversed, depth - 1);
|
||||
testMap(list.asMap(), depth - 1);
|
||||
}
|
||||
}
|
||||
|
||||
void testMap(Map<int, int> map, [int depth = 3]) {
|
||||
Expect.isTrue(map is Map<int, int>);
|
||||
Expect.isFalse(map is Map<int, String>);
|
||||
Expect.isFalse(map is Map<String, int>);
|
||||
if (depth > 0) {
|
||||
testIterable(map.keys, depth - 1);
|
||||
testIterable(map.values, depth - 1);
|
||||
}
|
||||
}
|
||||
|
||||
main() {
|
||||
// Empty lists.
|
||||
testList(<int>[]);
|
||||
testList(new List<int>.empty());
|
||||
testList(new List<int>());
|
||||
testList(const <int>[]);
|
||||
testList(new List<int>.generate(0, (x) => x + 1));
|
||||
// Singleton lists.
|
||||
testList(<int>[1]);
|
||||
testList(new List<int>.filled(1, 1));
|
||||
testList(new List<int>()..add(1));
|
||||
testList(const <int>[1]);
|
||||
testList(new List<int>.generate(1, (x) => x + 1));
|
||||
|
||||
// Typed lists.
|
||||
testList(new Uint8List(1)..[0] = 1); // //# 01: ok
|
||||
testList(new Int8List(1)..[0] = 1); // //# 01: continued
|
||||
testList(new Uint16List(1)..[0] = 1); // //# 01: continued
|
||||
testList(new Int16List(1)..[0] = 1); // //# 01: continued
|
||||
testList(new Uint32List(1)..[0] = 1); // //# 01: continued
|
||||
testList(new Int32List(1)..[0] = 1); // //# 01: continued
|
||||
testList(new Uint64List(1)..[0] = 1); // //# 02: ok
|
||||
testList(new Int64List(1)..[0] = 1); // //# 02: continued
|
||||
testList(new Uint8List(1)..[0] = 1);
|
||||
testList(new Int8List(1)..[0] = 1);
|
||||
testList(new Uint16List(1)..[0] = 1);
|
||||
testList(new Int16List(1)..[0] = 1);
|
||||
testList(new Uint32List(1)..[0] = 1);
|
||||
testList(new Int32List(1)..[0] = 1);
|
||||
|
||||
testIterable(new Set<int>()..add(1));
|
||||
testIterable(new HashSet<int>()..add(1));
|
||||
|
|
|
@ -34,8 +34,9 @@ regexp/pcre_test: Slow, Pass # Issue 21593
|
|||
*: SkipByDesign
|
||||
|
||||
[ $runtime != none && ($compiler == dart2js || $compiler == dartdevc || $compiler == dartdevk) ]
|
||||
int_parse_with_limited_ints_test: Skip # Requires fixed-size int64 support.
|
||||
typed_data_with_limited_ints_test: Skip # Requires fixed-size int64 support.
|
||||
int_parse_with_limited_ints_test: SkipByDesign # Requires fixed-size int64 support.
|
||||
iterable_return_type_int64_test: SkipByDesign # Requires int64 support.
|
||||
typed_data_with_limited_ints_test: SkipByDesign # Requires fixed-size int64 support.
|
||||
|
||||
[ $arch == simarm || $arch == simarm64 ]
|
||||
bigint_parse_radix_test: Skip # Issue 31659
|
||||
|
@ -44,8 +45,6 @@ bigint_test: Skip # Issue 31659
|
|||
[ $compiler == dartdevc || $compiler == dartdevk ]
|
||||
bigint_test/03: SkipSlow # modPow is very slow
|
||||
bigint_test/15: SkipSlow # modPow is very slow
|
||||
int_parse_with_limited_ints_test: Skip # Requires fixed-size int64 support.
|
||||
typed_data_with_limited_ints_test: Skip # Requires fixed-size int64 support.
|
||||
uri_parse_test: Slow, Pass
|
||||
uri_test: Slow, Pass
|
||||
|
||||
|
|
43
tests/corelib_2/iterable_return_type_helper.dart
Normal file
43
tests/corelib_2/iterable_return_type_helper.dart
Normal file
|
@ -0,0 +1,43 @@
|
|||
// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
|
||||
// for details. All rights reserved. Use of this source code is governed by a
|
||||
// BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
import "package:expect/expect.dart";
|
||||
|
||||
testIntIterable(iterable) {
|
||||
Expect.isTrue(iterable is Iterable<int>, "${iterable.runtimeType}");
|
||||
Expect.isFalse(iterable is Iterable<String>, "${iterable.runtimeType}");
|
||||
}
|
||||
|
||||
void testIterable(Iterable<int> iterable, [int depth = 3]) {
|
||||
testIntIterable(iterable);
|
||||
if (depth > 0) {
|
||||
testIterable(iterable.where((x) => true), depth - 1);
|
||||
testIterable(iterable.skip(1), depth - 1);
|
||||
testIterable(iterable.take(1), depth - 1);
|
||||
testIterable(iterable.skipWhile((x) => false), depth - 1);
|
||||
testIterable(iterable.takeWhile((x) => true), depth - 1);
|
||||
testList(iterable.toList(growable: true), depth - 1);
|
||||
testList(iterable.toList(growable: false), depth - 1);
|
||||
testIterable(iterable.toSet(), depth - 1);
|
||||
}
|
||||
}
|
||||
|
||||
void testList(List<int> list, [int depth = 3]) {
|
||||
testIterable(list, depth);
|
||||
if (depth > 0) {
|
||||
testIterable(list.getRange(0, list.length), depth - 1);
|
||||
testIterable(list.reversed, depth - 1);
|
||||
testMap(list.asMap(), depth - 1);
|
||||
}
|
||||
}
|
||||
|
||||
void testMap(Map<int, int> map, [int depth = 3]) {
|
||||
Expect.isTrue(map is Map<int, int>);
|
||||
Expect.isFalse(map is Map<int, String>);
|
||||
Expect.isFalse(map is Map<String, int>);
|
||||
if (depth > 0) {
|
||||
testIterable(map.keys, depth - 1);
|
||||
testIterable(map.values, depth - 1);
|
||||
}
|
||||
}
|
16
tests/corelib_2/iterable_return_type_int64_test.dart
Normal file
16
tests/corelib_2/iterable_return_type_int64_test.dart
Normal file
|
@ -0,0 +1,16 @@
|
|||
// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
|
||||
// for details. All rights reserved. Use of this source code is governed by a
|
||||
// BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
// Separate test for int64 support to be skipped on the web.
|
||||
|
||||
import 'iterable_return_type_helper.dart';
|
||||
|
||||
import 'dart:collection';
|
||||
import 'dart:typed_data';
|
||||
|
||||
main() {
|
||||
// Types for int64 support
|
||||
testList(new Uint64List(1)..[0] = 1);
|
||||
testList(new Int64List(1)..[0] = 1);
|
||||
}
|
|
@ -5,49 +5,11 @@
|
|||
// Regression test for dart2js where [List.addAll] was not typed
|
||||
// correctly.
|
||||
|
||||
import "package:expect/expect.dart";
|
||||
import 'iterable_return_type_helper.dart';
|
||||
|
||||
import 'dart:collection';
|
||||
import 'dart:typed_data';
|
||||
|
||||
testIntIterable(iterable) {
|
||||
Expect.isTrue(iterable is Iterable<int>, "${iterable.runtimeType}");
|
||||
Expect.isFalse(iterable is Iterable<String>, "${iterable.runtimeType}");
|
||||
}
|
||||
|
||||
void testIterable(Iterable<int> iterable, [int depth = 3]) {
|
||||
testIntIterable(iterable);
|
||||
if (depth > 0) {
|
||||
testIterable(iterable.where((x) => true), depth - 1);
|
||||
testIterable(iterable.skip(1), depth - 1);
|
||||
testIterable(iterable.take(1), depth - 1);
|
||||
testIterable(iterable.skipWhile((x) => false), depth - 1);
|
||||
testIterable(iterable.takeWhile((x) => true), depth - 1);
|
||||
testList(iterable.toList(growable: true), depth - 1);
|
||||
testList(iterable.toList(growable: false), depth - 1);
|
||||
testIterable(iterable.toSet(), depth - 1);
|
||||
}
|
||||
}
|
||||
|
||||
void testList(List<int> list, [int depth = 3]) {
|
||||
testIterable(list, depth);
|
||||
if (depth > 0) {
|
||||
testIterable(list.getRange(0, list.length), depth - 1);
|
||||
testIterable(list.reversed, depth - 1);
|
||||
testMap(list.asMap(), depth - 1);
|
||||
}
|
||||
}
|
||||
|
||||
void testMap(Map<int, int> map, [int depth = 3]) {
|
||||
Expect.isTrue(map is Map<int, int>);
|
||||
Expect.isFalse(map is Map<int, String>);
|
||||
Expect.isFalse(map is Map<String, int>);
|
||||
if (depth > 0) {
|
||||
testIterable(map.keys, depth - 1);
|
||||
testIterable(map.values, depth - 1);
|
||||
}
|
||||
}
|
||||
|
||||
main() {
|
||||
// Empty lists.
|
||||
testList(<int>[]);
|
||||
|
@ -63,14 +25,12 @@ main() {
|
|||
testList(new List<int>.generate(1, (x) => x + 1));
|
||||
|
||||
// Typed lists.
|
||||
testList(new Uint8List(1)..[0] = 1); // //# 01: ok
|
||||
testList(new Int8List(1)..[0] = 1); // //# 01: continued
|
||||
testList(new Uint16List(1)..[0] = 1); // //# 01: continued
|
||||
testList(new Int16List(1)..[0] = 1); // //# 01: continued
|
||||
testList(new Uint32List(1)..[0] = 1); // //# 01: continued
|
||||
testList(new Int32List(1)..[0] = 1); // //# 01: continued
|
||||
testList(new Uint64List(1)..[0] = 1); // //# 02: ok
|
||||
testList(new Int64List(1)..[0] = 1); // //# 02: continued
|
||||
testList(new Uint8List(1)..[0] = 1);
|
||||
testList(new Int8List(1)..[0] = 1);
|
||||
testList(new Uint16List(1)..[0] = 1);
|
||||
testList(new Int16List(1)..[0] = 1);
|
||||
testList(new Uint32List(1)..[0] = 1);
|
||||
testList(new Int32List(1)..[0] = 1);
|
||||
|
||||
testIterable(new Set<int>()..add(1));
|
||||
testIterable(new HashSet<int>()..add(1));
|
||||
|
|
Loading…
Reference in a new issue