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

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

Issue 1994613004: Handle use of constant constructors with default values. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated cf. comment 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> arguments) { 17 main(List<String> args) {
18 asyncTest(() async { 18 asyncTest(() async {
19 String serializedData = await serializeDartCore(); 19 Arguments arguments = new Arguments.from(args);
20 20 String serializedData = await serializeDartCore(arguments: arguments);
21 if (arguments.isNotEmpty) { 21 if (arguments.filename != null) {
22 Uri entryPoint = Uri.base.resolve(nativeToUriPath(arguments.last)); 22 Uri entryPoint = Uri.base.resolve(nativeToUriPath(arguments.filename));
23 await analyze(serializedData, entryPoint, null); 23 await analyze(serializedData, entryPoint, null);
24 } else { 24 } else {
25 Uri entryPoint = Uri.parse('memory:main.dart'); 25 Uri entryPoint = Uri.parse('memory:main.dart');
26 for (Test test in TESTS) { 26 await arguments.forEachTest(TESTS, (int index, Test test) async {
27 await analyze(serializedData, entryPoint, test); 27 await analyze(serializedData, entryPoint, test);
28 } 28 });
29 } 29 }
30 }); 30 });
31 } 31 }
32 32
33 Future analyze(String serializedData, Uri entryPoint, Test test) async { 33 Future analyze(String serializedData, Uri entryPoint, Test test,
34 {int index}) async {
35 String testDescription =
36 test != null ? test.sourceFiles[entryPoint.path] : '${entryPoint}';
37 print('------------------------------------------------------------------');
38 print('analyze ${index != null ? '$index:' :''}${testDescription}');
39 print('------------------------------------------------------------------');
34 DiagnosticCollector diagnosticCollector = new DiagnosticCollector(); 40 DiagnosticCollector diagnosticCollector = new DiagnosticCollector();
35 await runCompiler( 41 await runCompiler(
36 entryPoint: entryPoint, 42 entryPoint: entryPoint,
37 memorySourceFiles: test != null ? test.sourceFiles : const {}, 43 memorySourceFiles: test != null ? test.sourceFiles : const {},
38 options: [Flags.analyzeOnly], 44 options: [Flags.analyzeOnly],
39 diagnosticHandler: diagnosticCollector, 45 diagnosticHandler: diagnosticCollector,
40 beforeRun: (Compiler compiler) { 46 beforeRun: (Compiler compiler) {
41 compiler.serialization.deserializeFromText(serializedData); 47 compiler.serialization.deserializeFromText(serializedData);
42 }); 48 });
43 if (test != null) { 49 if (test != null) {
44 Expect.equals(test.expectedErrorCount, diagnosticCollector.errors.length, 50 Expect.equals(test.expectedErrorCount, diagnosticCollector.errors.length,
45 "Unexpected error count."); 51 "Unexpected error count.");
46 Expect.equals( 52 Expect.equals(
47 test.expectedWarningCount, 53 test.expectedWarningCount,
48 diagnosticCollector.warnings.length, 54 diagnosticCollector.warnings.length,
49 "Unexpected warning count."); 55 "Unexpected warning count.");
50 Expect.equals(test.expectedHintCount, diagnosticCollector.hints.length, 56 Expect.equals(test.expectedHintCount, diagnosticCollector.hints.length,
51 "Unexpected hint count."); 57 "Unexpected hint count.");
52 Expect.equals(test.expectedInfoCount, diagnosticCollector.infos.length, 58 Expect.equals(test.expectedInfoCount, diagnosticCollector.infos.length,
53 "Unexpected info count."); 59 "Unexpected info count.");
54 } 60 }
55 } 61 }
56 62
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/serialization/modelz.dart ('k') | tests/compiler/dart2js/serialization/compilation_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698