OLD | NEW |
| (Empty) |
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 | |
3 // BSD-style license that can be found in the LICENSE file. | |
4 | |
5 library trydart.internal_error_test; | |
6 | |
7 import 'dart:html'; | |
8 import 'dart:async'; | |
9 | |
10 import 'package:try/src/interaction_manager.dart' show | |
11 InteractionManager, | |
12 TRY_DART_NEW_DEFECT; | |
13 | |
14 import 'package:try/src/ui.dart' show | |
15 mainEditorPane, | |
16 observer, | |
17 outputDiv; | |
18 | |
19 import 'package:try/src/user_option.dart' show | |
20 UserOption; | |
21 | |
22 import 'package:expect/expect.dart'; | |
23 import 'package:async_helper/async_helper.dart'; | |
24 | |
25 main() { | |
26 UserOption.storage = {}; | |
27 | |
28 var interaction = new InteractionManager(); | |
29 mainEditorPane = new DivElement(); | |
30 outputDiv = new PreElement(); | |
31 document.body.append(mainEditorPane); | |
32 observer = new MutationObserver((mutations, observer) { | |
33 try { | |
34 interaction.onMutation(mutations, observer); | |
35 } catch (e) { | |
36 // Ignored. | |
37 } | |
38 }); | |
39 observer.observe( | |
40 mainEditorPane, childList: true, characterData: true, subtree: true); | |
41 | |
42 mainEditorPane.innerHtml = 'main() { print("hello"); }'; | |
43 | |
44 interaction.currentCompilationUnit = null; // This will provoke a crash. | |
45 | |
46 asyncTest(() { | |
47 return new Future(() { | |
48 Expect.isTrue(outputDiv.text.contains(TRY_DART_NEW_DEFECT)); | |
49 }); | |
50 }); | |
51 } | |
OLD | NEW |