Chromium Code Reviews| Index: tests/compiler/dart2js/emit_const_fields_test.dart |
| diff --git a/tests/compiler/dart2js/emit_const_fields_test.dart b/tests/compiler/dart2js/emit_const_fields_test.dart |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..63d0ce7ec0a12e83fbf143ca16234e04984883f7 |
| --- /dev/null |
| +++ b/tests/compiler/dart2js/emit_const_fields_test.dart |
| @@ -0,0 +1,25 @@ |
| +// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| +// for details. All rights reserved. Use of this source code is governed by a |
| +// BSD-style license that can be found in the LICENSE file. |
| +// Test that unused static consts are not emitted. |
| + |
| +import 'compiler_helper.dart'; |
| +import 'parser_helper.dart'; |
|
ngeoffray
2013/01/29 11:19:38
Do you need parser_helper?
erikcorry
2013/02/04 11:38:01
No.
Removed.
|
| + |
| +const String TEST_GUIDE = r""" |
| +class Guide { |
| + static const LTUAE = 42; |
| + static const TITLE = 'Life, the Universe and Everything'; |
| +} |
| + |
| +main() { |
| + return "${Guide.LTUAE}, ${Guide.TITLE}"; |
| +} |
| +"""; |
| + |
| +main() { |
| + String generated = compileAll(TEST_GUIDE); |
| + Expect.isTrue(generated.contains("42")); |
| + Expect.isFalse(generated.contains("TITLE")); |
| +} |
| + |