OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 // Test that parameters keep their names in the output. | 4 // Test that parameters keep their names in the output. |
5 | 5 |
6 import 'dart:convert'; | 6 import 'dart:convert'; |
7 import 'package:expect/expect.dart'; | 7 import 'package:expect/expect.dart'; |
8 import 'package:async_helper/async_helper.dart'; | 8 import 'package:async_helper/async_helper.dart'; |
9 import 'memory_compiler.dart'; | 9 import 'memory_compiler.dart'; |
10 | 10 |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 """; | 95 """; |
96 | 96 |
97 typedef void JsonTaking(Map<String, dynamic> json); | 97 typedef void JsonTaking(Map<String, dynamic> json); |
98 | 98 |
99 jsonTest(String program, JsonTaking testFn) async { | 99 jsonTest(String program, JsonTaking testFn) async { |
100 var result = await runCompiler( | 100 var result = await runCompiler( |
101 memorySourceFiles: {'main.dart': program}, options: ['--dump-info']); | 101 memorySourceFiles: {'main.dart': program}, options: ['--dump-info']); |
102 var compiler = result.compiler; | 102 var compiler = result.compiler; |
103 Expect.isFalse(compiler.compilationFailed); | 103 Expect.isFalse(compiler.compilationFailed); |
104 var dumpTask = compiler.dumpInfoTask; | 104 var dumpTask = compiler.dumpInfoTask; |
105 dumpTask.collectInfo(); | |
106 var info = dumpTask.infoCollector; | |
107 | 105 |
108 StringBuffer sb = new StringBuffer(); | 106 StringBuffer sb = new StringBuffer(); |
109 dumpTask.dumpInfoJson(sb); | 107 dumpTask.dumpInfoJson(sb); |
110 String json = sb.toString(); | 108 String json = sb.toString(); |
111 Map<String, dynamic> map = JSON.decode(json); | 109 Map<String, dynamic> map = JSON.decode(json); |
112 | 110 |
113 testFn(map); | 111 testFn(map); |
114 } | 112 } |
115 | 113 |
116 main() { | 114 main() { |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 Expect.isTrue(main_ != null); | 175 Expect.isTrue(main_ != null); |
178 Expect.isTrue(fn1 != null); | 176 Expect.isTrue(fn1 != null); |
179 Expect.isTrue(fn2 != null); | 177 Expect.isTrue(fn2 != null); |
180 Expect.isTrue(deps.containsKey(main_['id'])); | 178 Expect.isTrue(deps.containsKey(main_['id'])); |
181 Expect.isTrue(deps.containsKey(fn1['id'])); | 179 Expect.isTrue(deps.containsKey(fn1['id'])); |
182 Expect.isTrue(deps.containsKey(fn2['id'])); | 180 Expect.isTrue(deps.containsKey(fn2['id'])); |
183 Expect.isTrue(deps[main_['id']].any((dep) => dep['id'] == fn1['id'])); | 181 Expect.isTrue(deps[main_['id']].any((dep) => dep['id'] == fn1['id'])); |
184 Expect.isTrue(deps[fn1['id']].any((dep) => dep['id'] == fn2['id'])); | 182 Expect.isTrue(deps[fn1['id']].any((dep) => dep['id'] == fn2['id'])); |
185 }); | 183 }); |
186 } | 184 } |
OLD | NEW |