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

Side by Side Diff: tests/compiler/dart2js/type_inference7_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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 import "package:async_helper/async_helper.dart"; 5 import "package:async_helper/async_helper.dart";
6 import "package:expect/expect.dart"; 6 import "package:expect/expect.dart";
7 import 'compiler_helper.dart'; 7 import 'compiler_helper.dart';
8 import 'type_mask_test_helper.dart'; 8 import 'type_mask_test_helper.dart';
9 import 'dart:async'; 9 import 'dart:async';
10 10
(...skipping 15 matching lines...) Expand all
26 var commonMasks = compiler.commonMasks; 26 var commonMasks = compiler.commonMasks;
27 var typesInferrer = compiler.globalInference.typesInferrer; 27 var typesInferrer = compiler.globalInference.typesInferrer;
28 var foo = findElement(compiler, "foo"); 28 var foo = findElement(compiler, "foo");
29 // Return type is null|bool. 29 // Return type is null|bool.
30 var mask = typesInferrer.getReturnTypeOfElement(foo); 30 var mask = typesInferrer.getReturnTypeOfElement(foo);
31 Expect.isTrue(mask.isNullable); 31 Expect.isTrue(mask.isNullable);
32 Expect.equals(commonMasks.boolType, simplify(mask.nonNullable(), compiler)); 32 Expect.equals(commonMasks.boolType, simplify(mask.nonNullable(), compiler));
33 // First parameter is uint31|String|bool. 33 // First parameter is uint31|String|bool.
34 var mask1 = typesInferrer.getTypeOfElement(foo.parameters[0]); 34 var mask1 = typesInferrer.getTypeOfElement(foo.parameters[0]);
35 Expect.isTrue(mask1.isUnion); 35 Expect.isTrue(mask1.isUnion);
36 var expectedTypes = new Set.from([commonMasks.uint31Type, 36 var expectedTypes = new Set.from(
37 commonMasks.stringType, 37 [commonMasks.uint31Type, commonMasks.stringType, commonMasks.boolType]);
38 commonMasks.boolType]);
39 for (var typeMask in mask1.disjointMasks) { 38 for (var typeMask in mask1.disjointMasks) {
40 Expect.isFalse(typeMask.isNullable); 39 Expect.isFalse(typeMask.isNullable);
41 var simpleType = simplify(typeMask, compiler); 40 var simpleType = simplify(typeMask, compiler);
42 Expect.isTrue(expectedTypes.remove(simpleType), "$simpleType"); 41 Expect.isTrue(expectedTypes.remove(simpleType), "$simpleType");
43 } 42 }
44 Expect.isTrue(expectedTypes.isEmpty); 43 Expect.isTrue(expectedTypes.isEmpty);
45 // Second parameter is bool or null. 44 // Second parameter is bool or null.
46 var mask2 = typesInferrer.getTypeOfElement(foo.parameters[1]); 45 var mask2 = typesInferrer.getTypeOfElement(foo.parameters[1]);
47 Expect.isTrue(mask2.isNullable); 46 Expect.isTrue(mask2.isNullable);
48 Expect.equals( 47 Expect.equals(
(...skipping 22 matching lines...) Expand all
71 } 70 }
72 } 71 }
73 72
74 main() { 73 main() {
75 asyncStart(); 74 asyncStart();
76 runTest().then((_) { 75 runTest().then((_) {
77 // Make sure that the type is still correct when we do a second compilation. 76 // Make sure that the type is still correct when we do a second compilation.
78 return runTest(); 77 return runTest();
79 }).whenComplete(asyncEnd); 78 }).whenComplete(asyncEnd);
80 } 79 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/type_inference5_test.dart ('k') | tests/compiler/dart2js/type_mask2_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698