OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 // Ensure that unused empty HashMap nodes are dropped from the output. | 5 // Ensure that unused empty HashMap nodes are dropped from the output. |
6 | 6 |
7 import 'package:expect/expect.dart'; | 7 import 'package:expect/expect.dart'; |
8 import 'package:compiler/compiler_new.dart'; | 8 import 'package:compiler/compiler_new.dart'; |
9 import 'package:async_helper/async_helper.dart'; | 9 import 'package:async_helper/async_helper.dart'; |
10 import 'memory_compiler.dart'; | 10 import 'memory_compiler.dart'; |
11 | 11 |
12 const TEST_SOURCE = const { | 12 const TEST_SOURCE = const { |
13 "main.dart": r""" | 13 "main.dart": r""" |
14 void main() { | 14 void main() { |
15 var x = {}; | 15 var x = {}; |
16 return; | 16 return; |
17 } | 17 } |
18 """ | 18 """ |
19 }; | 19 }; |
20 | 20 |
21 const HASHMAP_EMPTY_CONSTRUCTOR = r"LinkedHashMap_LinkedHashMap$_empty"; | 21 const HASHMAP_EMPTY_CONSTRUCTOR = r"LinkedHashMap_LinkedHashMap$_empty"; |
22 | 22 |
23 main() { | 23 main() { |
24 asyncTest(() async { | 24 asyncTest(() async { |
25 var collector = new OutputCollector(); | 25 var collector = new OutputCollector(); |
26 var result = await runCompiler( | 26 await runCompiler( |
27 memorySourceFiles: TEST_SOURCE, outputProvider: collector); | 27 memorySourceFiles: TEST_SOURCE, outputProvider: collector); |
28 var compiler = result.compiler; | |
29 String generated = collector.getOutput('', OutputType.js); | 28 String generated = collector.getOutput('', OutputType.js); |
30 Expect.isFalse(generated.contains(HASHMAP_EMPTY_CONSTRUCTOR)); | 29 Expect.isFalse(generated.contains(HASHMAP_EMPTY_CONSTRUCTOR)); |
31 }); | 30 }); |
32 } | 31 } |
OLD | NEW |