| 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:async_helper/async_helper.dart'; | 9 import 'package:async_helper/async_helper.dart'; |
| 9 import 'memory_compiler.dart'; | 10 import 'memory_compiler.dart'; |
| 10 | 11 |
| 11 const TEST_SOURCE = const { | 12 const TEST_SOURCE = const { |
| 12 "main.dart": r""" | 13 "main.dart": r""" |
| 13 void main() { | 14 void main() { |
| 14 var x = {}; | 15 var x = {}; |
| 15 return; | 16 return; |
| 16 } | 17 } |
| 17 """ | 18 """ |
| 18 }; | 19 }; |
| 19 | 20 |
| 20 const HASHMAP_EMPTY_CONSTRUCTOR = r"LinkedHashMap_LinkedHashMap$_empty"; | 21 const HASHMAP_EMPTY_CONSTRUCTOR = r"LinkedHashMap_LinkedHashMap$_empty"; |
| 21 | 22 |
| 22 main() { | 23 main() { |
| 23 asyncTest(() async { | 24 asyncTest(() async { |
| 24 var collector = new OutputCollector(); | 25 var collector = new OutputCollector(); |
| 25 var result = await runCompiler( | 26 var result = await runCompiler( |
| 26 memorySourceFiles: TEST_SOURCE, outputProvider: collector); | 27 memorySourceFiles: TEST_SOURCE, outputProvider: collector); |
| 27 var compiler = result.compiler; | 28 var compiler = result.compiler; |
| 28 String generated = collector.getOutput('', 'js'); | 29 String generated = collector.getOutput('', OutputType.js); |
| 29 Expect.isFalse(generated.contains(HASHMAP_EMPTY_CONSTRUCTOR)); | 30 Expect.isFalse(generated.contains(HASHMAP_EMPTY_CONSTRUCTOR)); |
| 30 }); | 31 }); |
| 31 } | 32 } |
| OLD | NEW |