OLD | NEW |
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 // SharedOptions=-Dsend_stats=true | 4 // SharedOptions=-Dsend_stats=true |
5 | 5 |
6 /// Tests that we compute send metrics correctly in many simple scenarios. | 6 /// Tests that we compute send metrics correctly in many simple scenarios. |
7 library dart2js.test.send_measurements_test; | 7 library dart2js.test.send_measurements_test; |
8 | 8 |
9 import 'dart:async'; | 9 import 'dart:async'; |
10 import 'package:test/test.dart'; | 10 import 'package:test/test.dart'; |
11 import 'package:dart2js_info/info.dart'; | 11 import 'package:dart2js_info/info.dart'; |
| 12 import 'package:dart2js_info/src/util.dart' show |
| 13 recursiveDiagnosticString; |
12 import 'memory_compiler.dart'; | 14 import 'memory_compiler.dart'; |
13 import 'dart:io'; | |
14 | 15 |
15 main() { | 16 main() { |
16 test('nothing is reachable, nothing to count', () { | 17 test('nothing is reachable, nothing to count', () { |
17 return _check(''' | 18 return _check(''' |
18 main() {} | 19 main() {} |
19 test() { int x = 3; } | 20 test() { int x = 3; } |
20 '''); | 21 '''); |
21 }); | 22 }); |
22 | 23 |
23 test('local variable read', () { | 24 test('local variable read', () { |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 } | 331 } |
331 | 332 |
332 /// Helper that runs the compiler and returns the [GlobalResult] computed for | 333 /// Helper that runs the compiler and returns the [GlobalResult] computed for |
333 /// it. | 334 /// it. |
334 Future<AllInfo> _compileAndGetStats(String program) async { | 335 Future<AllInfo> _compileAndGetStats(String program) async { |
335 var result = await runCompiler( | 336 var result = await runCompiler( |
336 memorySourceFiles: {'main.dart': program}, options: ['--dump-info']); | 337 memorySourceFiles: {'main.dart': program}, options: ['--dump-info']); |
337 expect(result.compiler.compilationFailed, isFalse); | 338 expect(result.compiler.compilationFailed, isFalse); |
338 return result.compiler.dumpInfoTask.infoCollector.result; | 339 return result.compiler.dumpInfoTask.infoCollector.result; |
339 } | 340 } |
OLD | NEW |