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