Index: tests/compiler/dart2js/kernel/compile_from_dill_test_helper.dart |
diff --git a/tests/compiler/dart2js/kernel/compile_from_dill_test.dart b/tests/compiler/dart2js/kernel/compile_from_dill_test_helper.dart |
similarity index 81% |
copy from tests/compiler/dart2js/kernel/compile_from_dill_test.dart |
copy to tests/compiler/dart2js/kernel/compile_from_dill_test_helper.dart |
index 22bd53a8605f772a129ff61869c8660c81805c7a..8f781d4784591942b8b8c9f8279f088a0b8cefc2 100644 |
--- a/tests/compiler/dart2js/kernel/compile_from_dill_test.dart |
+++ b/tests/compiler/dart2js/kernel/compile_from_dill_test_helper.dart |
@@ -2,14 +2,13 @@ |
// 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. |
-// Partial test that the closed world computed from [WorldImpact]s derived from |
-// kernel is equivalent to the original computed from resolution. |
-library dart2js.kernel.compile_from_dill_test; |
+// Helper to test compilation equivalence between source and .dill based |
+// compilation. |
+library dart2js.kernel.compile_from_dill_test_helper; |
import 'dart:async'; |
import 'dart:io'; |
-import 'package:async_helper/async_helper.dart'; |
import 'package:compiler/compiler_new.dart'; |
import 'package:compiler/src/commandline_options.dart'; |
import 'package:compiler/src/common.dart'; |
@@ -26,59 +25,18 @@ import 'package:expect/expect.dart'; |
import '../memory_compiler.dart'; |
import '../equivalence/check_functions.dart'; |
import '../equivalence/check_helpers.dart'; |
-import '../serialization/helper.dart'; |
import 'test_helpers.dart'; |
import 'compiler_helper.dart'; |
-const SOURCE = const { |
- 'main.dart': ''' |
-foo({named}) => 1; |
-bar(a) => !a; |
-class Class { |
- var field; |
- static var staticField; |
- Class(this.field); |
-} |
-main() { |
- foo(); |
- bar(true); |
- []; |
- {}; |
- new Object(); |
- new Class(''); |
- Class.staticField; |
- var x = null; |
- for (int i = 0; i < 10; i++) { |
- x = i; |
- if (i == 5) break; |
- } |
- return x; |
-} |
-''' |
-}; |
- |
-main(List<String> args) { |
- asyncTest(() async { |
- await mainInternal(args); |
- }); |
-} |
- |
enum ResultKind { crashes, errors, warnings, success, failure } |
-Future<ResultKind> mainInternal(List<String> args, |
- {bool skipWarnings: false, bool skipErrors: false}) async { |
- Arguments arguments = new Arguments.from(args); |
- Uri entryPoint; |
- Map<String, String> memorySourceFiles; |
- if (arguments.uri != null) { |
- entryPoint = arguments.uri; |
- memorySourceFiles = const <String, String>{}; |
- } else { |
- entryPoint = Uri.parse('memory:main.dart'); |
- memorySourceFiles = SOURCE; |
- } |
- |
+Future<ResultKind> runTest( |
+ Uri entryPoint, Map<String, String> memorySourceFiles, |
+ {bool skipWarnings: false, |
+ bool skipErrors: false, |
+ bool verbose: false, |
+ List<String> options: const <String>[]}) async { |
enableDebugMode(); |
EnumCreator.matchKernelRepresentationForTesting = true; |
Elements.usePatchedDart2jsSdkSorting = true; |
@@ -101,7 +59,7 @@ Future<ResultKind> mainInternal(List<String> args, |
Flags.disableTypeInference, |
Flags.disableInlining, |
Flags.enableAssertMessage |
- ]); |
+ ]..addAll(options)); |
ElementResolutionWorldBuilder.useInstantiationMap = true; |
compiler1.resolution.retainCachesForTesting = true; |
await compiler1.run(entryPoint); |
@@ -129,7 +87,7 @@ Future<ResultKind> mainInternal(List<String> args, |
Flags.disableTypeInference, |
Flags.disableInlining, |
Flags.enableAssertMessage |
- ], |
+ ]..addAll(options), |
printSteps: true, |
compilerOutput: collector2); |
@@ -154,12 +112,12 @@ Future<ResultKind> mainInternal(List<String> args, |
return equivalence.typeEquivalence(unalias(a), b); |
}, |
elementFilter: elementFilter, |
- verbose: arguments.verbose); |
+ verbose: verbose); |
print('--- checking closed worlds -----------------------------------------'); |
checkClosedWorlds(closedWorld1, closedWorld2, |
strategy: equivalence.defaultStrategy, |
- verbose: arguments.verbose, |
+ verbose: verbose, |
// TODO(johnniwinther,efortuna): Require closure class equivalence when |
// these are supported. |
allowMissingClosureClasses: true); |
@@ -175,14 +133,14 @@ Future<ResultKind> mainInternal(List<String> args, |
return equivalence.typeEquivalence(unalias(a), b); |
}, |
elementFilter: elementFilter, |
- verbose: arguments.verbose); |
+ verbose: verbose); |
checkEmitters(compiler1.backend.emitter, compiler2.backend.emitter, |
elementEquivalence: (a, b) => equivalence.entityEquivalence(a, b), |
typeEquivalence: (DartType a, DartType b) { |
return equivalence.typeEquivalence(unalias(a), b); |
}, |
- verbose: arguments.verbose); |
+ verbose: verbose); |
print('--- checking output------- -----------------------------------------'); |
collector1.outputMap |