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

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

Issue 1969313007: Handle explicit constructor. (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) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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_compilation_test; 5 library dart2js.serialization_compilation_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'; 15 import 'package:compiler/src/serialization/system.dart';
16 import '../memory_compiler.dart'; 16 import '../memory_compiler.dart';
17 import 'helper.dart'; 17 import 'helper.dart';
18 import 'test_data.dart'; 18 import 'test_data.dart';
19 import '../output_collector.dart'; 19 import '../output_collector.dart';
20 20
21 main(List<String> args) { 21 main(List<String> args) {
22 asyncTest(() async { 22 asyncTest(() async {
23 Arguments arguments = new Arguments.from(args); 23 Arguments arguments = new Arguments.from(args);
24 String serializedData = await serializeDartCore(arguments: arguments); 24 String serializedData = await serializeDartCore(arguments: arguments);
25 if (arguments.filename != null) { 25 if (arguments.filename != null) {
26 Uri entryPoint = Uri.base.resolve(nativeToUriPath(arguments.filename)); 26 Uri entryPoint = Uri.base.resolve(nativeToUriPath(arguments.filename));
27 await compile(serializedData, entryPoint, null); 27 await compile(serializedData, entryPoint, null);
28 } else { 28 } else {
29 Uri entryPoint = Uri.parse('memory:main.dart'); 29 Uri entryPoint = Uri.parse('memory:main.dart');
30 int start = arguments.index ?? 0; 30 arguments.forEachTest(TESTS, (int index, Test test) async {
31 int end = arguments.index ?? TESTS.length - 1;
32 for (int index = start; index <= end; index++) {
33 Test test = TESTS[index];
34 await compile(serializedData, entryPoint, test, 31 await compile(serializedData, entryPoint, test,
35 index: index, 32 index: index,
36 verbose: arguments.verbose); 33 verbose: arguments.verbose);
37 } 34 });
38 } 35 }
39 }); 36 });
40 } 37 }
41 38
42 Future compile(String serializedData, Uri entryPoint, Test test, 39 Future compile(String serializedData, Uri entryPoint, Test test,
43 {int index, bool verbose: false}) async { 40 {int index, bool verbose: false}) async {
44 String testDescription = 41 String testDescription =
45 test != null ? test.sourceFiles[entryPoint.path] : '${entryPoint}'; 42 test != null ? test.sourceFiles[entryPoint.path] : '${entryPoint}';
46 print('------------------------------------------------------------------'); 43 print('------------------------------------------------------------------');
47 print('compile ${index != null ? '$index:' :''}${testDescription}'); 44 print('compile ${index != null ? '$index:' :''}${testDescription}');
48 print('------------------------------------------------------------------'); 45 print('------------------------------------------------------------------');
49 OutputCollector outputCollector = new OutputCollector(); 46 OutputCollector outputCollector = new OutputCollector();
50 await runCompiler( 47 await runCompiler(
51 entryPoint: entryPoint, 48 entryPoint: entryPoint,
52 memorySourceFiles: test != null ? test.sourceFiles : const {}, 49 memorySourceFiles: test != null ? test.sourceFiles : const {},
53 options: [], 50 options: [],
54 outputProvider: outputCollector, 51 outputProvider: outputCollector,
55 beforeRun: (Compiler compiler) { 52 beforeRun: (Compiler compiler) {
56 compiler.serialization.deserializeFromText(serializedData); 53 compiler.serialization.deserializeFromText(serializedData);
57 }); 54 });
58 if (verbose) { 55 if (verbose) {
59 print(outputCollector.getOutput('', 'js')); 56 print(outputCollector.getOutput('', 'js'));
60 } 57 }
61 } 58 }
62 59
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698