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

Side by Side Diff: tests/compiler/dart2js/serialization/analysis_test.dart

Issue 2004833003: Support multiple resolution inputs from command line. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Fix and check library separation Created 4 years, 7 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) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 library dart2js.serialization_analysis_test; 5 library dart2js.serialization_analysis_test;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'package:async_helper/async_helper.dart'; 8 import 'package:async_helper/async_helper.dart';
9 import 'package:expect/expect.dart'; 9 import 'package:expect/expect.dart';
10 import 'package:compiler/src/commandline_options.dart'; 10 import 'package:compiler/src/commandline_options.dart';
11 import 'package:compiler/src/compiler.dart'; 11 import 'package:compiler/src/compiler.dart';
12 import 'package:compiler/src/filenames.dart'; 12 import 'package:compiler/src/filenames.dart';
13 import '../memory_compiler.dart'; 13 import '../memory_compiler.dart';
14 import 'helper.dart'; 14 import 'helper.dart';
15 import 'test_data.dart'; 15 import 'test_data.dart';
16 16
17 main(List<String> args) { 17 main(List<String> args) {
18 asyncTest(() async { 18 asyncTest(() async {
19 Arguments arguments = new Arguments.from(args); 19 Arguments arguments = new Arguments.from(args);
20 String serializedData = await serializeDartCore(arguments: arguments); 20 SerializedData serializedData =
21 await serializeDartCore(arguments: arguments);
21 if (arguments.filename != null) { 22 if (arguments.filename != null) {
22 Uri entryPoint = Uri.base.resolve(nativeToUriPath(arguments.filename)); 23 Uri entryPoint = Uri.base.resolve(nativeToUriPath(arguments.filename));
23 await analyze(serializedData, entryPoint, null); 24 await analyze(serializedData, entryPoint, null);
24 } else { 25 } else {
25 Uri entryPoint = Uri.parse('memory:main.dart'); 26 Uri entryPoint = Uri.parse('memory:main.dart');
26 await arguments.forEachTest(TESTS, (int index, Test test) async { 27 await arguments.forEachTest(TESTS, (int index, Test test) async {
27 await analyze(serializedData, entryPoint, test); 28 await analyze(serializedData, entryPoint, test);
28 }); 29 });
29 } 30 }
30 }); 31 });
31 } 32 }
32 33
33 Future analyze(String serializedData, Uri entryPoint, Test test, 34 Future analyze(SerializedData serializedData, Uri entryPoint, Test test,
34 {int index}) async { 35 {int index}) async {
35 String testDescription = 36 String testDescription =
36 test != null ? test.sourceFiles[entryPoint.path] : '${entryPoint}'; 37 test != null ? test.sourceFiles[entryPoint.path] : '${entryPoint}';
37 print('------------------------------------------------------------------'); 38 print('------------------------------------------------------------------');
38 print('analyze ${index != null ? '$index:' :''}${testDescription}'); 39 print('analyze ${index != null ? '$index:' :''}${testDescription}');
39 print('------------------------------------------------------------------'); 40 print('------------------------------------------------------------------');
40 DiagnosticCollector diagnosticCollector = new DiagnosticCollector(); 41 DiagnosticCollector diagnosticCollector = new DiagnosticCollector();
41 await runCompiler( 42 await runCompiler(
42 entryPoint: entryPoint, 43 entryPoint: entryPoint,
43 memorySourceFiles: test != null ? test.sourceFiles : const {}, 44 resolutionInputs: serializedData.toUris(),
45 memorySourceFiles: serializedData.toMemorySourceFiles(
46 test != null ? test.sourceFiles : null),
44 options: [Flags.analyzeOnly], 47 options: [Flags.analyzeOnly],
45 diagnosticHandler: diagnosticCollector, 48 diagnosticHandler: diagnosticCollector);
46 beforeRun: (Compiler compiler) {
47 compiler.serialization.deserializeFromText(serializedData);
48 });
49 if (test != null) { 49 if (test != null) {
50 Expect.equals(test.expectedErrorCount, diagnosticCollector.errors.length, 50 Expect.equals(test.expectedErrorCount, diagnosticCollector.errors.length,
51 "Unexpected error count."); 51 "Unexpected error count.");
52 Expect.equals( 52 Expect.equals(
53 test.expectedWarningCount, 53 test.expectedWarningCount,
54 diagnosticCollector.warnings.length, 54 diagnosticCollector.warnings.length,
55 "Unexpected warning count."); 55 "Unexpected warning count.");
56 Expect.equals(test.expectedHintCount, diagnosticCollector.hints.length, 56 Expect.equals(test.expectedHintCount, diagnosticCollector.hints.length,
57 "Unexpected hint count."); 57 "Unexpected hint count.");
58 Expect.equals(test.expectedInfoCount, diagnosticCollector.infos.length, 58 Expect.equals(test.expectedInfoCount, diagnosticCollector.infos.length,
59 "Unexpected info count."); 59 "Unexpected info count.");
60 } 60 }
61 } 61 }
62 62
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698