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

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

Issue 2013763002: Add names and support for preserialized data to serialization tests (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated cf. comments. Created 4 years, 6 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 SerializedData serializedData = 20 SerializedData serializedData =
21 await serializeDartCore(arguments: arguments); 21 await serializeDartCore(arguments: arguments);
22 if (arguments.filename != null) { 22 if (arguments.filename != null) {
23 Uri entryPoint = Uri.base.resolve(nativeToUriPath(arguments.filename)); 23 Uri entryPoint = Uri.base.resolve(nativeToUriPath(arguments.filename));
24 await analyze(serializedData, entryPoint, null); 24 await analyze(entryPoint,
25 resolutionInputs: serializedData.toUris(),
26 sourceFiles: serializedData.toMemorySourceFiles());
25 } else { 27 } else {
26 Uri entryPoint = Uri.parse('memory:main.dart'); 28 await arguments.forEachTest(serializedData, TESTS, analyze);
27 await arguments.forEachTest(TESTS, (int index, Test test) async {
28 await analyze(serializedData, entryPoint, test);
29 });
30 } 29 }
31 }); 30 });
32 } 31 }
33 32
34 Future analyze(SerializedData serializedData, Uri entryPoint, Test test, 33 Future analyze(
35 {int index}) async { 34 Uri entryPoint,
36 String testDescription = 35 {Map<String, String> sourceFiles: const <String, String>{},
37 test != null ? test.sourceFiles[entryPoint.path] : '${entryPoint}'; 36 List<Uri> resolutionInputs,
37 int index,
38 Test test,
39 bool verbose: false}) async {
40 String testDescription = test != null ? test.name : '${entryPoint}';
41 String id = index != null ? '$index: ' : '';
38 print('------------------------------------------------------------------'); 42 print('------------------------------------------------------------------');
39 print('analyze ${index != null ? '$index:' :''}${testDescription}'); 43 print('analyze ${id}${testDescription}');
40 print('------------------------------------------------------------------'); 44 print('------------------------------------------------------------------');
41 DiagnosticCollector diagnosticCollector = new DiagnosticCollector(); 45 DiagnosticCollector diagnosticCollector = new DiagnosticCollector();
42 await runCompiler( 46 await runCompiler(
43 entryPoint: entryPoint, 47 entryPoint: entryPoint,
44 resolutionInputs: serializedData.toUris(), 48 resolutionInputs: resolutionInputs,
45 memorySourceFiles: serializedData.toMemorySourceFiles( 49 memorySourceFiles: sourceFiles,
46 test != null ? test.sourceFiles : null),
47 options: [Flags.analyzeOnly], 50 options: [Flags.analyzeOnly],
48 diagnosticHandler: diagnosticCollector); 51 diagnosticHandler: diagnosticCollector);
49 if (test != null) { 52 if (test != null) {
50 Expect.equals(test.expectedErrorCount, diagnosticCollector.errors.length, 53 Expect.equals(test.expectedErrorCount, diagnosticCollector.errors.length,
51 "Unexpected error count."); 54 "Unexpected error count.");
52 Expect.equals( 55 Expect.equals(
53 test.expectedWarningCount, 56 test.expectedWarningCount,
54 diagnosticCollector.warnings.length, 57 diagnosticCollector.warnings.length,
55 "Unexpected warning count."); 58 "Unexpected warning count.");
56 Expect.equals(test.expectedHintCount, diagnosticCollector.hints.length, 59 Expect.equals(test.expectedHintCount, diagnosticCollector.hints.length,
57 "Unexpected hint count."); 60 "Unexpected hint count.");
58 Expect.equals(test.expectedInfoCount, diagnosticCollector.infos.length, 61 Expect.equals(test.expectedInfoCount, diagnosticCollector.infos.length,
59 "Unexpected info count."); 62 "Unexpected info count.");
60 } 63 }
61 } 64 }
62 65
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/serialization/system.dart ('k') | tests/compiler/dart2js/serialization/compilation_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698