OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 library tests.dart2js.interop_anonymous_unreachable_test; | 5 library tests.dart2js.interop_anonymous_unreachable_test; |
6 | 6 |
7 import 'dart:async'; | |
8 | |
9 import 'package:test/test.dart'; | 7 import 'package:test/test.dart'; |
10 import 'compiler_helper.dart'; | 8 import 'compiler_helper.dart'; |
11 | 9 |
12 main() { | 10 main() { |
13 test("unreachable code doesn't crash the compiler", () async { | 11 test("unreachable code doesn't crash the compiler", () async { |
14 // This test is a regression for Issue #24974 | 12 // This test is a regression for Issue #24974 |
15 String generated = await compile( | 13 String generated = await compile( |
16 """ | 14 """ |
17 import 'package:js/js.dart'; | 15 import 'package:js/js.dart'; |
18 | 16 |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 | 165 |
168 generated = await compile(program2, returnAll: true); | 166 generated = await compile(program2, returnAll: true); |
169 expect(generated.contains("UniqueLongNameForTesting_A"), isTrue); | 167 expect(generated.contains("UniqueLongNameForTesting_A"), isTrue); |
170 // This extra check is to make sure that we don't include HTMLAudioElement | 168 // This extra check is to make sure that we don't include HTMLAudioElement |
171 // just because of the is-check. It is optimized away in this case because | 169 // just because of the is-check. It is optimized away in this case because |
172 // we believe it was never instantiated. | 170 // we believe it was never instantiated. |
173 expect(generated.contains("HTMLAudioElement"), isFalse); | 171 expect(generated.contains("HTMLAudioElement"), isFalse); |
174 }); | 172 }); |
175 }); | 173 }); |
176 } | 174 } |
OLD | NEW |