Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(171)

Unified Diff: tests/compiler/dart2js/field_type_simple_inferer_test.dart

Issue 2345083003: dart2js: run dartfmt on tests (Closed)
Patch Set: revert another multipart test Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests/compiler/dart2js/field_codegen_test.dart ('k') | tests/compiler/dart2js/field_update_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/compiler/dart2js/field_type_simple_inferer_test.dart
diff --git a/tests/compiler/dart2js/field_type_simple_inferer_test.dart b/tests/compiler/dart2js/field_type_simple_inferer_test.dart
index ad287786a35f5080b320e5d8f1eac59be8b0ef80..59ae8774518b4816d380a3a5e7efd4245c80c1d6 100644
--- a/tests/compiler/dart2js/field_type_simple_inferer_test.dart
+++ b/tests/compiler/dart2js/field_type_simple_inferer_test.dart
@@ -4,25 +4,20 @@
import 'package:expect/expect.dart';
import 'package:async_helper/async_helper.dart';
-import 'package:compiler/src/types/types.dart'
- show TypeMask;
+import 'package:compiler/src/types/types.dart' show TypeMask;
import 'compiler_helper.dart';
import 'type_mask_test_helper.dart';
-void compileAndFind(String code,
- String className,
- String memberName,
- bool disableInlining,
- check(compiler, element)) {
+void compileAndFind(String code, String className, String memberName,
+ bool disableInlining, check(compiler, element)) {
Uri uri = new Uri(scheme: 'source');
- var compiler = compilerFor(code, uri,
- disableInlining: disableInlining);
+ var compiler = compilerFor(code, uri, disableInlining: disableInlining);
asyncTest(() => compiler.run(uri).then((_) {
- var cls = findElement(compiler, className);
- var member = cls.lookupMember(memberName);
- check(compiler, member);
- }));
+ var cls = findElement(compiler, className);
+ var member = cls.lookupMember(memberName);
+ check(compiler, member);
+ }));
}
const String TEST_1 = r"""
@@ -179,7 +174,6 @@ const String TEST_10 = r"""
}
""";
-
const String TEST_11 = r"""
class S {
int fs = 1;
@@ -477,17 +471,12 @@ const String TEST_27 = r"""
void doTest(String test, bool disableInlining, Map<String, Function> fields) {
fields.forEach((String name, Function f) {
- compileAndFind(
- test,
- 'A',
- name,
- disableInlining,
- (compiler, field) {
- TypeMask type = f(compiler.commonMasks);
- var inferrer = compiler.globalInference.typesInferrer;
- TypeMask inferredType =
- simplify(inferrer.getTypeOfElement(field), inferrer.compiler);
- Expect.equals(type, inferredType, test);
+ compileAndFind(test, 'A', name, disableInlining, (compiler, field) {
+ TypeMask type = f(compiler.commonMasks);
+ var inferrer = compiler.globalInference.typesInferrer;
+ TypeMask inferredType =
+ simplify(inferrer.getTypeOfElement(field), inferrer.compiler);
+ Expect.equals(type, inferredType, test);
});
});
}
@@ -502,21 +491,22 @@ void test() {
findTypeMask(types.compiler, 'Interceptor', 'nonNullSubclass');
runTest(TEST_1, {'f': (types) => types.nullType});
- runTest(TEST_2, {'f1': (types) => types.nullType,
- 'f2': (types) => types.uint31Type});
- runTest(TEST_3, {'f1': (types) => types.uint31Type,
- 'f2': (types) => types.uint31Type.nullable()});
- runTest(TEST_4, {'f1': subclassOfInterceptor,
- 'f2': (types) => types.stringType.nullable()});
+ runTest(TEST_2,
+ {'f1': (types) => types.nullType, 'f2': (types) => types.uint31Type});
+ runTest(TEST_3, {
+ 'f1': (types) => types.uint31Type,
+ 'f2': (types) => types.uint31Type.nullable()
+ });
+ runTest(TEST_4, {
+ 'f1': subclassOfInterceptor,
+ 'f2': (types) => types.stringType.nullable()
+ });
// TODO(ngeoffray): We should try to infer that the initialization
// code at the declaration site of the fields does not matter.
- runTest(TEST_5, {'f1': subclassOfInterceptor,
- 'f2': subclassOfInterceptor});
- runTest(TEST_6, {'f1': subclassOfInterceptor,
- 'f2': subclassOfInterceptor});
- runTest(TEST_7, {'f1': subclassOfInterceptor,
- 'f2': subclassOfInterceptor});
+ runTest(TEST_5, {'f1': subclassOfInterceptor, 'f2': subclassOfInterceptor});
+ runTest(TEST_6, {'f1': subclassOfInterceptor, 'f2': subclassOfInterceptor});
+ runTest(TEST_7, {'f1': subclassOfInterceptor, 'f2': subclassOfInterceptor});
runTest(TEST_8, {'f': (types) => types.stringType.nullable()});
runTest(TEST_9, {'f': (types) => types.stringType.nullable()});
@@ -529,43 +519,55 @@ void test() {
runTest(TEST_13, {'fs': (types) => types.uint31Type});
runTest(TEST_14, {'f': (types) => types.uint31Type});
- runTest(TEST_15, {'f': (types) {
- ClassElement cls =
- types.compiler.backend.helpers.jsIndexableClass;
- return new TypeMask.nonNullSubtype(cls,
- types.compiler.world);
- }});
+ runTest(TEST_15, {
+ 'f': (types) {
+ ClassElement cls = types.compiler.backend.helpers.jsIndexableClass;
+ return new TypeMask.nonNullSubtype(cls, types.compiler.world);
+ }
+ });
runTest(TEST_16, {'f': subclassOfInterceptor});
runTest(TEST_17, {'f': (types) => types.uint31Type.nullable()});
- runTest(TEST_18, {'f1': (types) => types.uint31Type,
- 'f2': (types) => types.stringType,
- 'f3': (types) => types.dynamicType});
- runTest(TEST_19, {'f1': (types) => types.uint31Type,
- 'f2': (types) => types.stringType,
- 'f3': (types) => types.dynamicType});
+ runTest(TEST_18, {
+ 'f1': (types) => types.uint31Type,
+ 'f2': (types) => types.stringType,
+ 'f3': (types) => types.dynamicType
+ });
+ runTest(TEST_19, {
+ 'f1': (types) => types.uint31Type,
+ 'f2': (types) => types.stringType,
+ 'f3': (types) => types.dynamicType
+ });
runTest(TEST_20, {'f': (types) => types.uint31Type.nullable()});
runTest(TEST_21, {'f': (types) => types.uint31Type.nullable()});
- runTest(TEST_22, {'f1': (types) => types.uint31Type,
- 'f2': (types) => types.uint31Type,
- 'f3': (types) => types.stringType.nullable()});
-
- runTest(TEST_23, {'f1': (types) => types.uint31Type.nullable(),
- 'f2': (types) => types.uint31Type.nullable(),
- 'f3': (types) => types.uint31Type.nullable(),
- 'f4': (types) => types.uint31Type.nullable()});
-
- runTest(TEST_24, {'f1': (types) => types.positiveIntType,
- 'f2': (types) => types.positiveIntType,
- 'f3': (types) => types.uint31Type,
- 'f4': (types) => types.uint31Type,
- 'f5': (types) => types.numType.nullable(),
- 'f6': (types) => types.stringType.nullable()});
-
- runTest(TEST_25, {'f1': (types) => types.uint31Type });
- runTest(TEST_26, {'f1': (types) => types.positiveIntType });
- runTest(TEST_27, {'f1': (types) => types.uint31Type,
- 'f2': (types) => types.uint31Type.nullable()});
+ runTest(TEST_22, {
+ 'f1': (types) => types.uint31Type,
+ 'f2': (types) => types.uint31Type,
+ 'f3': (types) => types.stringType.nullable()
+ });
+
+ runTest(TEST_23, {
+ 'f1': (types) => types.uint31Type.nullable(),
+ 'f2': (types) => types.uint31Type.nullable(),
+ 'f3': (types) => types.uint31Type.nullable(),
+ 'f4': (types) => types.uint31Type.nullable()
+ });
+
+ runTest(TEST_24, {
+ 'f1': (types) => types.positiveIntType,
+ 'f2': (types) => types.positiveIntType,
+ 'f3': (types) => types.uint31Type,
+ 'f4': (types) => types.uint31Type,
+ 'f5': (types) => types.numType.nullable(),
+ 'f6': (types) => types.stringType.nullable()
+ });
+
+ runTest(TEST_25, {'f1': (types) => types.uint31Type});
+ runTest(TEST_26, {'f1': (types) => types.positiveIntType});
+ runTest(TEST_27, {
+ 'f1': (types) => types.uint31Type,
+ 'f2': (types) => types.uint31Type.nullable()
+ });
}
void main() {
« no previous file with comments | « tests/compiler/dart2js/field_codegen_test.dart ('k') | tests/compiler/dart2js/field_update_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698