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 "package:expect/expect.dart"; | 6 import "package:expect/expect.dart"; |
7 import "package:async_helper/async_helper.dart"; | 7 import "package:async_helper/async_helper.dart"; |
8 import 'memory_compiler.dart'; | 8 import 'memory_compiler.dart'; |
9 import 'package:compiler/src/dump_info.dart'; | 9 import 'package:compiler/src/dump_info.dart'; |
10 import 'dart:convert'; | 10 import 'dart:convert'; |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 """; | 96 """; |
97 | 97 |
98 typedef void JsonTaking(Map<String, dynamic> json); | 98 typedef void JsonTaking(Map<String, dynamic> json); |
99 | 99 |
100 void jsonTest(String program, JsonTaking testFn) { | 100 void jsonTest(String program, JsonTaking testFn) { |
101 var compiler = compilerFor({'main.dart': program}, options: ['--dump-info']); | 101 var compiler = compilerFor({'main.dart': program}, options: ['--dump-info']); |
102 asyncTest(() => compiler.runCompiler(Uri.parse('memory:main.dart')).then( | 102 asyncTest(() => compiler.runCompiler(Uri.parse('memory:main.dart')).then( |
103 (_) { | 103 (_) { |
104 Expect.isFalse(compiler.compilationFailed); | 104 Expect.isFalse(compiler.compilationFailed); |
105 var dumpTask = compiler.dumpInfoTask; | 105 var dumpTask = compiler.dumpInfoTask; |
106 dumpTask.collectInfo(); | 106 dumpTask.collectInfo(0); |
107 var info = dumpTask.infoCollector; | 107 var info = dumpTask.infoCollector; |
108 | 108 |
109 StringBuffer sb = new StringBuffer(); | 109 StringBuffer sb = new StringBuffer(); |
110 dumpTask.dumpInfoJson(sb); | 110 dumpTask.dumpInfoJson(sb); |
111 String json = sb.toString(); | 111 String json = sb.toString(); |
112 Map<String, dynamic> map = JSON.decode(json); | 112 Map<String, dynamic> map = JSON.decode(json); |
113 | 113 |
114 testFn(map); | 114 testFn(map); |
115 })); | 115 })); |
116 } | 116 } |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 Expect.isTrue(main_ != null); | 175 Expect.isTrue(main_ != null); |
176 Expect.isTrue(fn1 != null); | 176 Expect.isTrue(fn1 != null); |
177 Expect.isTrue(fn2 != null); | 177 Expect.isTrue(fn2 != null); |
178 Expect.isTrue(deps.containsKey(main_['id'])); | 178 Expect.isTrue(deps.containsKey(main_['id'])); |
179 Expect.isTrue(deps.containsKey(fn1['id'])); | 179 Expect.isTrue(deps.containsKey(fn1['id'])); |
180 Expect.isTrue(deps.containsKey(fn2['id'])); | 180 Expect.isTrue(deps.containsKey(fn2['id'])); |
181 Expect.isTrue(deps[main_['id']].any((dep) => dep['id'] == fn1['id'])); | 181 Expect.isTrue(deps[main_['id']].any((dep) => dep['id'] == fn1['id'])); |
182 Expect.isTrue(deps[fn1['id']].any((dep) => dep['id'] == fn2['id'])); | 182 Expect.isTrue(deps[fn1['id']].any((dep) => dep['id'] == fn2['id'])); |
183 }); | 183 }); |
184 } | 184 } |
OLD | NEW |