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

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

Issue 1975153002: Support (de)serialization from command-line (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: 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/common/backend_api.dart'; 11 import 'package:compiler/src/common/backend_api.dart';
12 import 'package:compiler/src/common/names.dart'; 12 import 'package:compiler/src/common/names.dart';
13 import 'package:compiler/src/compiler.dart'; 13 import 'package:compiler/src/compiler.dart';
14 import 'package:compiler/src/filenames.dart'; 14 import 'package:compiler/src/filenames.dart';
15 import 'package:compiler/src/serialization/system.dart';
Siggi Cherem (dart-lang) 2016/05/14 01:10:31 unused import? (same thing in the next few files
Johnni Winther 2016/05/17 12:37:34 So it was...
15 import '../memory_compiler.dart'; 16 import '../memory_compiler.dart';
16 import 'helper.dart'; 17 import 'helper.dart';
17 import 'test_data.dart'; 18 import 'test_data.dart';
18 19
19 main(List<String> arguments) { 20 main(List<String> arguments) {
20 asyncTest(() async { 21 asyncTest(() async {
21 String serializedData = await serializeDartCore(); 22 String serializedData = await serializeDartCore();
22 23
23 if (arguments.isNotEmpty) { 24 if (arguments.isNotEmpty) {
24 Uri entryPoint = Uri.base.resolve(nativeToUriPath(arguments.last)); 25 Uri entryPoint = Uri.base.resolve(nativeToUriPath(arguments.last));
25 await analyze(serializedData, entryPoint, null); 26 await analyze(serializedData, entryPoint, null);
26 } else { 27 } else {
27 Uri entryPoint = Uri.parse('memory:main.dart'); 28 Uri entryPoint = Uri.parse('memory:main.dart');
28 for (Test test in TESTS) { 29 for (Test test in TESTS) {
29 await analyze(serializedData, entryPoint, test); 30 await analyze(serializedData, entryPoint, test);
30 } 31 }
31 } 32 }
32 }); 33 });
33 } 34 }
34 35
35 Future analyze(String serializedData, Uri entryPoint, Test test) async { 36 Future analyze(String serializedData, Uri entryPoint, Test test) async {
36 DiagnosticCollector diagnosticCollector = new DiagnosticCollector(); 37 DiagnosticCollector diagnosticCollector = new DiagnosticCollector();
37 await runCompiler( 38 await runCompiler(
38 entryPoint: entryPoint, 39 entryPoint: entryPoint,
39 memorySourceFiles: test != null ? test.sourceFiles : const {}, 40 memorySourceFiles: test != null ? test.sourceFiles : const {},
40 options: [Flags.analyzeOnly], 41 options: [Flags.analyzeOnly],
41 diagnosticHandler: diagnosticCollector, 42 diagnosticHandler: diagnosticCollector,
42 beforeRun: (Compiler compiler) { 43 beforeRun: (Compiler compiler) {
43 deserialize(compiler, serializedData); 44 compiler.serialization.deserializeFromText(serializedData);
44 }); 45 });
45 if (test != null) { 46 if (test != null) {
46 Expect.equals(test.expectedErrorCount, diagnosticCollector.errors.length, 47 Expect.equals(test.expectedErrorCount, diagnosticCollector.errors.length,
47 "Unexpected error count."); 48 "Unexpected error count.");
48 Expect.equals( 49 Expect.equals(
49 test.expectedWarningCount, 50 test.expectedWarningCount,
50 diagnosticCollector.warnings.length, 51 diagnosticCollector.warnings.length,
51 "Unexpected warning count."); 52 "Unexpected warning count.");
52 Expect.equals(test.expectedHintCount, diagnosticCollector.hints.length, 53 Expect.equals(test.expectedHintCount, diagnosticCollector.hints.length,
53 "Unexpected hint count."); 54 "Unexpected hint count.");
54 Expect.equals(test.expectedInfoCount, diagnosticCollector.infos.length, 55 Expect.equals(test.expectedInfoCount, diagnosticCollector.infos.length,
55 "Unexpected info count."); 56 "Unexpected info count.");
56 } 57 }
57 } 58 }
58 59
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698