OLD | NEW |
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 '../memory_compiler.dart'; | 15 import '../memory_compiler.dart'; |
16 import 'helper.dart'; | 16 import 'helper.dart'; |
17 import 'test_data.dart'; | 17 import 'test_data.dart'; |
18 import '../output_collector.dart'; | 18 import '../output_collector.dart'; |
19 | 19 |
20 main(List<String> args) { | 20 main(List<String> args) { |
21 asyncTest(() async { | 21 asyncTest(() async { |
22 Arguments arguments = new Arguments.from(args); | 22 Arguments arguments = new Arguments.from(args); |
23 String serializedData = await serializeDartCore(arguments: arguments); | 23 String serializedData = await serializeDartCore(arguments: arguments); |
24 if (arguments.filename != null) { | 24 if (arguments.filename != null) { |
25 Uri entryPoint = Uri.base.resolve(nativeToUriPath(arguments.filename)); | 25 Uri entryPoint = Uri.base.resolve(nativeToUriPath(arguments.filename)); |
26 await compile(serializedData, entryPoint, null); | 26 await compile(serializedData, entryPoint, null); |
27 } else { | 27 } else { |
28 Uri entryPoint = Uri.parse('memory:main.dart'); | 28 Uri entryPoint = Uri.parse('memory:main.dart'); |
29 // TODO(johnniwinther): Handle the remaining tests. | |
30 int start = arguments.index ?? 0; | 29 int start = arguments.index ?? 0; |
31 int end = arguments.index ?? 16/*TESTS.length - 1*/; | 30 int end = arguments.index ?? TESTS.length - 1; |
32 for (int index = start; index <= end; index++) { | 31 for (int index = start; index <= end; index++) { |
33 Test test = TESTS[index]; | 32 Test test = TESTS[index]; |
34 await compile(serializedData, entryPoint, test, | 33 await compile(serializedData, entryPoint, test, |
35 index: index, | 34 index: index, |
36 verbose: arguments.verbose); | 35 verbose: arguments.verbose); |
37 } | 36 } |
38 } | 37 } |
39 }); | 38 }); |
40 } | 39 } |
41 | 40 |
(...skipping 11 matching lines...) Expand all Loading... |
53 options: [], | 52 options: [], |
54 outputProvider: outputCollector, | 53 outputProvider: outputCollector, |
55 beforeRun: (Compiler compiler) { | 54 beforeRun: (Compiler compiler) { |
56 deserialize(compiler, serializedData); | 55 deserialize(compiler, serializedData); |
57 }); | 56 }); |
58 if (verbose) { | 57 if (verbose) { |
59 print(outputCollector.getOutput('', 'js')); | 58 print(outputCollector.getOutput('', 'js')); |
60 } | 59 } |
61 } | 60 } |
62 | 61 |
OLD | NEW |