OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 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 | 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 // Test that unused static consts are not emitted. | 4 // Test that unused static consts are not emitted. |
5 | 5 |
6 import "package:expect/expect.dart"; | |
7 import 'compiler_helper.dart'; | 6 import 'compiler_helper.dart'; |
8 | 7 |
9 const String TEST_GUIDE = r""" | 8 const String TEST_GUIDE = r""" |
10 class Guide { | 9 class Guide { |
11 static const LTUAE = 42; | 10 static const LTUAE = 42; |
12 static const TITLE = 'Life, the Universe and Everything'; | 11 static const TITLE = 'Life, the Universe and Everything'; |
13 } | 12 } |
14 | 13 |
15 main() { | 14 main() { |
16 return "${Guide.LTUAE}, ${Guide.TITLE}"; | 15 return "${Guide.LTUAE}, ${Guide.TITLE}"; |
17 } | 16 } |
18 """; | 17 """; |
19 | 18 |
20 main() { | 19 main() { |
21 String generated = compileAll(TEST_GUIDE); | 20 String generated = compileAll(TEST_GUIDE); |
22 Expect.isTrue(generated.contains("42")); | 21 Expect.isTrue(generated.contains("42")); |
23 Expect.isFalse(generated.contains("TITLE")); | 22 Expect.isFalse(generated.contains("TITLE")); |
24 } | 23 } |
25 | 24 |
OLD | NEW |