| OLD | NEW |
| 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'; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 await analyze(entryPoint, | 30 await analyze(entryPoint, |
| 31 resolutionInputs: serializedData.toUris(), | 31 resolutionInputs: serializedData.toUris(), |
| 32 sourceFiles: serializedData.toMemorySourceFiles()); | 32 sourceFiles: serializedData.toMemorySourceFiles()); |
| 33 } else { | 33 } else { |
| 34 await arguments.forEachTest(serializedData, TESTS, analyze); | 34 await arguments.forEachTest(serializedData, TESTS, analyze); |
| 35 } | 35 } |
| 36 printMeasurementResults(); | 36 printMeasurementResults(); |
| 37 }); | 37 }); |
| 38 } | 38 } |
| 39 | 39 |
| 40 Future analyze( | 40 Future analyze(Uri entryPoint, |
| 41 Uri entryPoint, | |
| 42 {Map<String, String> sourceFiles: const <String, String>{}, | 41 {Map<String, String> sourceFiles: const <String, String>{}, |
| 43 List<Uri> resolutionInputs, | 42 List<Uri> resolutionInputs, |
| 44 int index, | 43 int index, |
| 45 Test test, | 44 Test test, |
| 46 bool verbose: false}) async { | 45 bool verbose: false}) async { |
| 47 String testDescription = test != null ? test.name : '${entryPoint}'; | 46 String testDescription = test != null ? test.name : '${entryPoint}'; |
| 48 String id = index != null ? '$index: ' : ''; | 47 String id = index != null ? '$index: ' : ''; |
| 49 String title = '${id}${testDescription}'; | 48 String title = '${id}${testDescription}'; |
| 50 await measure(title, 'analyze', () async { | 49 await measure(title, 'analyze', () async { |
| 51 DiagnosticCollector diagnosticCollector = new DiagnosticCollector(); | 50 DiagnosticCollector diagnosticCollector = new DiagnosticCollector(); |
| 52 await runCompiler( | 51 await runCompiler( |
| 53 entryPoint: entryPoint, | 52 entryPoint: entryPoint, |
| 54 resolutionInputs: resolutionInputs, | 53 resolutionInputs: resolutionInputs, |
| 55 memorySourceFiles: sourceFiles, | 54 memorySourceFiles: sourceFiles, |
| 56 options: [Flags.analyzeOnly], | 55 options: [Flags.analyzeOnly], |
| 57 diagnosticHandler: diagnosticCollector); | 56 diagnosticHandler: diagnosticCollector); |
| 58 if (test != null) { | 57 if (test != null) { |
| 59 Expect.equals(test.expectedErrorCount, diagnosticCollector.errors.length, | 58 Expect.equals(test.expectedErrorCount, diagnosticCollector.errors.length, |
| 60 "Unexpected error count."); | 59 "Unexpected error count."); |
| 61 Expect.equals( | 60 Expect.equals(test.expectedWarningCount, |
| 62 test.expectedWarningCount, | 61 diagnosticCollector.warnings.length, "Unexpected warning count."); |
| 63 diagnosticCollector.warnings.length, | |
| 64 "Unexpected warning count."); | |
| 65 Expect.equals(test.expectedHintCount, diagnosticCollector.hints.length, | 62 Expect.equals(test.expectedHintCount, diagnosticCollector.hints.length, |
| 66 "Unexpected hint count."); | 63 "Unexpected hint count."); |
| 67 Expect.equals(test.expectedInfoCount, diagnosticCollector.infos.length, | 64 Expect.equals(test.expectedInfoCount, diagnosticCollector.infos.length, |
| 68 "Unexpected info count."); | 65 "Unexpected info count."); |
| 69 } | 66 } |
| 70 }); | 67 }); |
| 71 } | 68 } |
| 72 | |
| OLD | NEW |