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'; |
11 import 'package:compiler/src/common/backend_api.dart'; | |
12 import 'package:compiler/src/common/names.dart'; | |
13 import 'package:compiler/src/compiler.dart'; | 11 import 'package:compiler/src/compiler.dart'; |
14 import 'package:compiler/src/filenames.dart'; | 12 import 'package:compiler/src/filenames.dart'; |
15 import '../memory_compiler.dart'; | 13 import '../memory_compiler.dart'; |
16 import 'helper.dart'; | 14 import 'helper.dart'; |
17 import 'test_data.dart'; | 15 import 'test_data.dart'; |
18 | 16 |
19 main(List<String> arguments) { | 17 main(List<String> arguments) { |
20 asyncTest(() async { | 18 asyncTest(() async { |
21 String serializedData = await serializeDartCore(); | 19 String serializedData = await serializeDartCore(); |
22 | 20 |
(...skipping 10 matching lines...) Expand all Loading... |
33 } | 31 } |
34 | 32 |
35 Future analyze(String serializedData, Uri entryPoint, Test test) async { | 33 Future analyze(String serializedData, Uri entryPoint, Test test) async { |
36 DiagnosticCollector diagnosticCollector = new DiagnosticCollector(); | 34 DiagnosticCollector diagnosticCollector = new DiagnosticCollector(); |
37 await runCompiler( | 35 await runCompiler( |
38 entryPoint: entryPoint, | 36 entryPoint: entryPoint, |
39 memorySourceFiles: test != null ? test.sourceFiles : const {}, | 37 memorySourceFiles: test != null ? test.sourceFiles : const {}, |
40 options: [Flags.analyzeOnly], | 38 options: [Flags.analyzeOnly], |
41 diagnosticHandler: diagnosticCollector, | 39 diagnosticHandler: diagnosticCollector, |
42 beforeRun: (Compiler compiler) { | 40 beforeRun: (Compiler compiler) { |
43 deserialize(compiler, serializedData); | 41 compiler.serialization.deserializeFromText(serializedData); |
44 }); | 42 }); |
45 if (test != null) { | 43 if (test != null) { |
46 Expect.equals(test.expectedErrorCount, diagnosticCollector.errors.length, | 44 Expect.equals(test.expectedErrorCount, diagnosticCollector.errors.length, |
47 "Unexpected error count."); | 45 "Unexpected error count."); |
48 Expect.equals( | 46 Expect.equals( |
49 test.expectedWarningCount, | 47 test.expectedWarningCount, |
50 diagnosticCollector.warnings.length, | 48 diagnosticCollector.warnings.length, |
51 "Unexpected warning count."); | 49 "Unexpected warning count."); |
52 Expect.equals(test.expectedHintCount, diagnosticCollector.hints.length, | 50 Expect.equals(test.expectedHintCount, diagnosticCollector.hints.length, |
53 "Unexpected hint count."); | 51 "Unexpected hint count."); |
54 Expect.equals(test.expectedInfoCount, diagnosticCollector.infos.length, | 52 Expect.equals(test.expectedInfoCount, diagnosticCollector.infos.length, |
55 "Unexpected info count."); | 53 "Unexpected info count."); |
56 } | 54 } |
57 } | 55 } |
58 | 56 |
OLD | NEW |