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 library test.integration.analysis.outline; | 5 library test.integration.analysis.outline; |
6 | 6 |
7 import 'package:analysis_server/src/protocol.dart'; | 7 import 'package:analysis_server/src/protocol.dart'; |
8 import 'package:test_reflective_loader/test_reflective_loader.dart'; | 8 import 'package:test_reflective_loader/test_reflective_loader.dart'; |
9 import 'package:unittest/unittest.dart'; | 9 import 'package:unittest/unittest.dart'; |
10 | 10 |
| 11 import '../../utils.dart'; |
11 import '../integration_tests.dart'; | 12 import '../integration_tests.dart'; |
12 | 13 |
13 main() { | 14 main() { |
| 15 initializeTestEnvironment(); |
14 defineReflectiveTests(Test); | 16 defineReflectiveTests(Test); |
15 } | 17 } |
16 | 18 |
17 @reflectiveTest | 19 @reflectiveTest |
18 class Test extends AbstractAnalysisServerIntegrationTest { | 20 class Test extends AbstractAnalysisServerIntegrationTest { |
19 /** | 21 /** |
20 * Verify that the range of source text covered by the given outline objects | 22 * Verify that the range of source text covered by the given outline objects |
21 * is connected (the end of each object in the list corresponds to the start | 23 * is connected (the end of each object in the list corresponds to the start |
22 * of the next). | 24 * of the next). |
23 */ | 25 */ |
(...skipping 22 matching lines...) Expand all Loading... |
46 | 48 |
47 set setter(value) { | 49 set setter(value) { |
48 } | 50 } |
49 } | 51 } |
50 | 52 |
51 class Class2 { | 53 class Class2 { |
52 } | 54 } |
53 '''; | 55 '''; |
54 writeFile(pathname, text); | 56 writeFile(pathname, text); |
55 standardAnalysisSetup(); | 57 standardAnalysisSetup(); |
56 sendAnalysisSetSubscriptions({AnalysisService.OUTLINE: [pathname]}); | 58 sendAnalysisSetSubscriptions({ |
| 59 AnalysisService.OUTLINE: [pathname] |
| 60 }); |
57 Outline outline; | 61 Outline outline; |
58 onAnalysisOutline.listen((AnalysisOutlineParams params) { | 62 onAnalysisOutline.listen((AnalysisOutlineParams params) { |
59 expect(params.file, equals(pathname)); | 63 expect(params.file, equals(pathname)); |
60 outline = params.outline; | 64 outline = params.outline; |
61 }); | 65 }); |
62 return analysisFinished.then((_) { | 66 return analysisFinished.then((_) { |
63 expect(outline.element.kind, equals(ElementKind.COMPILATION_UNIT)); | 67 expect(outline.element.kind, equals(ElementKind.COMPILATION_UNIT)); |
64 expect(outline.offset, equals(0)); | 68 expect(outline.offset, equals(0)); |
65 expect(outline.length, equals(text.length)); | 69 expect(outline.length, equals(text.length)); |
66 List<Outline> classes = outline.children; | 70 List<Outline> classes = outline.children; |
67 expect(classes, hasLength(2)); | 71 expect(classes, hasLength(2)); |
68 expect(classes[0].element.name, equals('Class1')); | 72 expect(classes[0].element.name, equals('Class1')); |
69 expect(classes[1].element.name, equals('Class2')); | 73 expect(classes[1].element.name, equals('Class2')); |
70 checkConnected(classes); | 74 checkConnected(classes); |
71 List<Outline> members = classes[0].children; | 75 List<Outline> members = classes[0].children; |
72 expect(members, hasLength(5)); | 76 expect(members, hasLength(5)); |
73 expect(members[0].element.name, equals('field')); | 77 expect(members[0].element.name, equals('field')); |
74 expect(members[1].element.name, equals('method')); | 78 expect(members[1].element.name, equals('method')); |
75 expect(members[2].element.name, equals('staticMethod')); | 79 expect(members[2].element.name, equals('staticMethod')); |
76 expect(members[3].element.name, equals('getter')); | 80 expect(members[3].element.name, equals('getter')); |
77 expect(members[4].element.name, equals('setter')); | 81 expect(members[4].element.name, equals('setter')); |
78 checkConnected(members); | 82 checkConnected(members); |
79 }); | 83 }); |
80 } | 84 } |
81 } | 85 } |
OLD | NEW |