OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 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. |
| 4 |
| 5 import 'dart:async'; |
| 6 import 'package:expect/expect.dart'; |
| 7 import 'package:async_helper/async_helper.dart'; |
| 8 import 'compiler_helper.dart'; |
| 9 |
| 10 const String TEST_ONE = r""" |
| 11 main() { |
| 12 var f = use; |
| 13 if (false) { |
| 14 // This statement and the use of 'foo' should be optimized away, causing |
| 15 // 'foo' to be absent from the final code. |
| 16 f(foo); |
| 17 } |
| 18 f(bar); |
| 19 } |
| 20 |
| 21 foo() => 'Tarantula!'; |
| 22 bar() => 'Coelacanth!'; |
| 23 |
| 24 use(x) { |
| 25 print(x()); |
| 26 } |
| 27 """; |
| 28 |
| 29 |
| 30 main() { |
| 31 asyncTest(() => Future.wait([ |
| 32 compileAll(TEST_ONE).then((String generated) { |
| 33 Expect.isFalse(generated.contains('Tarantula!'), |
| 34 "failed to remove 'foo'"); |
| 35 Expect.isTrue(generated.contains('Coelacanth!')); |
| 36 }), |
| 37 ])); |
| 38 } |
OLD | NEW |