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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 | 105 |
106 StringBuffer sb = new StringBuffer(); | 106 StringBuffer sb = new StringBuffer(); |
107 dumpTask.dumpInfoJson(sb); | 107 dumpTask.dumpInfoJson(sb, compiler.closedWorld); |
108 String json = sb.toString(); | 108 String json = sb.toString(); |
109 Map<String, dynamic> map = JSON.decode(json); | 109 Map<String, dynamic> map = JSON.decode(json); |
110 | 110 |
111 testFn(map); | 111 testFn(map); |
112 } | 112 } |
113 | 113 |
114 main() { | 114 main() { |
115 asyncTest(runTests); | 115 asyncTest(runTests); |
116 } | 116 } |
117 | 117 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 Expect.isTrue(main_ != null); | 172 Expect.isTrue(main_ != null); |
173 Expect.isTrue(fn1 != null); | 173 Expect.isTrue(fn1 != null); |
174 Expect.isTrue(fn2 != null); | 174 Expect.isTrue(fn2 != null); |
175 Expect.isTrue(deps.containsKey(main_['id'])); | 175 Expect.isTrue(deps.containsKey(main_['id'])); |
176 Expect.isTrue(deps.containsKey(fn1['id'])); | 176 Expect.isTrue(deps.containsKey(fn1['id'])); |
177 Expect.isTrue(deps.containsKey(fn2['id'])); | 177 Expect.isTrue(deps.containsKey(fn2['id'])); |
178 Expect.isTrue(deps[main_['id']].any((dep) => dep['id'] == fn1['id'])); | 178 Expect.isTrue(deps[main_['id']].any((dep) => dep['id'] == fn1['id'])); |
179 Expect.isTrue(deps[fn1['id']].any((dep) => dep['id'] == fn2['id'])); | 179 Expect.isTrue(deps[fn1['id']].any((dep) => dep['id'] == fn2['id'])); |
180 }); | 180 }); |
181 } | 181 } |
OLD | NEW |