OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 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 | 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 /// Test that poi.dart can serialize a scope. | 5 /// Test that poi.dart can serialize a scope. |
6 | 6 |
7 library trydart.serialize_test; | 7 library trydart.serialize_test; |
8 | 8 |
9 import 'dart:io' show | 9 import 'dart:io' show |
10 Platform; | 10 Platform; |
(...skipping 13 matching lines...) Expand all Loading... |
24 import 'package:compiler/implementation/elements/elements.dart' show | 24 import 'package:compiler/implementation/elements/elements.dart' show |
25 Element; | 25 Element; |
26 | 26 |
27 import 'package:compiler/implementation/source_file_provider.dart' show | 27 import 'package:compiler/implementation/source_file_provider.dart' show |
28 FormattingDiagnosticHandler; | 28 FormattingDiagnosticHandler; |
29 | 29 |
30 Future testPoi() { | 30 Future testPoi() { |
31 Uri script = Platform.script.resolve('data/interesting.dart'); | 31 Uri script = Platform.script.resolve('data/interesting.dart'); |
32 FormattingDiagnosticHandler handler = new FormattingDiagnosticHandler(); | 32 FormattingDiagnosticHandler handler = new FormattingDiagnosticHandler(); |
33 | 33 |
34 int position = 241; | 34 int position = 263; |
| 35 |
35 Future future = poi.runPoi(script, position, handler.provider, handler); | 36 Future future = poi.runPoi(script, position, handler.provider, handler); |
36 return future.then((Element element) { | 37 return future.then((Element element) { |
37 Uri foundScript = element.compilationUnit.script.resourceUri; | 38 Uri foundScript = element.compilationUnit.script.resourceUri; |
38 Expect.stringEquals('$script', '$foundScript'); | 39 Expect.stringEquals('$script', '$foundScript'); |
39 Expect.stringEquals('fisk', element.name); | 40 Expect.stringEquals('fisk', element.name); |
40 | 41 |
41 Expect.stringEquals( | 42 Expect.stringEquals( |
42 JSON.encode(expected), | 43 JSON.encode(expected), |
43 JSON.encode(JSON.decode(poi.scopeInformation(element, position)))); | 44 JSON.encode(JSON.decode(poi.scopeInformation(element, position)))); |
44 }); | 45 }); |
(...skipping 17 matching lines...) Expand all Loading... |
62 { | 63 { |
63 "name": "hest", | 64 "name": "hest", |
64 "kind": "function" | 65 "kind": "function" |
65 }, | 66 }, |
66 { | 67 { |
67 "name": "", | 68 "name": "", |
68 "kind": "generative_constructor" | 69 "kind": "generative_constructor" |
69 } | 70 } |
70 ], | 71 ], |
71 "enclosing": { | 72 "enclosing": { |
72 "name": "tests/try/poi/data/interesting.dart", | 73 "name": "interesting", |
73 "kind": "library", | 74 "kind": "library", |
74 "members": [ | 75 "members": [ |
75 { | 76 { |
76 "name": "main", | 77 "name": "main", |
77 "kind": "function" | 78 "kind": "function" |
78 }, | 79 }, |
79 { | 80 { |
80 "name": "Foo", | 81 "name": "Foo", |
81 "kind": "class" | 82 "kind": "class" |
82 } | 83 } |
83 ] | 84 ] |
84 } | 85 } |
85 } | 86 } |
86 }; | 87 }; |
OLD | NEW |