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 import 'dart:async'; | 5 import 'dart:async'; |
6 | 6 |
7 import 'package:analysis_server/protocol/protocol.dart'; | 7 import 'package:analysis_server/protocol/protocol.dart'; |
8 import 'package:analysis_server/protocol/protocol_generated.dart'; | 8 import 'package:analysis_server/protocol/protocol_generated.dart'; |
9 import 'package:test/test.dart'; | 9 import 'package:test/test.dart'; |
10 import 'package:test_reflective_loader/test_reflective_loader.dart'; | 10 import 'package:test_reflective_loader/test_reflective_loader.dart'; |
11 | 11 |
12 import 'abstract_search_domain.dart'; | 12 import 'abstract_search_domain.dart'; |
13 | 13 |
14 main() { | 14 main() { |
15 defineReflectiveSuite(() { | 15 defineReflectiveSuite(() { |
16 defineReflectiveTests(ElementReferencesTest); | 16 defineReflectiveTests(ElementReferencesTest); |
17 }); | 17 }); |
18 } | 18 } |
19 | 19 |
20 @reflectiveTest | 20 @reflectiveTest |
21 class ElementReferencesTest extends AbstractSearchDomainTest { | 21 class ElementReferencesTest extends AbstractSearchDomainTest { |
22 Element searchElement; | 22 Element searchElement; |
23 | 23 |
| 24 @override |
| 25 bool get enableNewAnalysisDriver => false; |
| 26 |
24 void assertHasRef(SearchResultKind kind, String search, bool isPotential) { | 27 void assertHasRef(SearchResultKind kind, String search, bool isPotential) { |
25 assertHasResult(kind, search); | 28 assertHasResult(kind, search); |
26 expect(result.isPotential, isPotential); | 29 expect(result.isPotential, isPotential); |
27 } | 30 } |
28 | 31 |
29 Future<Null> findElementReferences( | 32 Future<Null> findElementReferences( |
30 String search, bool includePotential) async { | 33 String search, bool includePotential) async { |
31 int offset = findOffset(search); | 34 int offset = findOffset(search); |
32 await waitForTasksFinished(); | 35 await waitForTasksFinished(); |
33 Request request = new SearchFindElementReferencesParams( | 36 Request request = new SearchFindElementReferencesParams( |
34 testFile, offset, includePotential) | 37 testFile, offset, includePotential) |
35 .toRequest('0'); | 38 .toRequest('0'); |
36 Response response = await waitResponse(request); | 39 Response response = await waitResponse(request); |
37 var result = new SearchFindElementReferencesResult.fromResponse(response); | 40 var result = new SearchFindElementReferencesResult.fromResponse(response); |
38 searchId = result.id; | 41 searchId = result.id; |
39 searchElement = result.element; | 42 searchElement = result.element; |
40 if (searchId != null) { | 43 if (searchId != null) { |
41 await waitForSearchResults(); | 44 await waitForSearchResults(); |
42 } | 45 } |
43 expect(serverErrors, isEmpty); | 46 expect(serverErrors, isEmpty); |
44 } | 47 } |
45 | 48 |
46 @override | |
47 void setUp() { | |
48 enableNewAnalysisDriver = false; | |
49 super.setUp(); | |
50 } | |
51 | |
52 test_constructor_named() async { | 49 test_constructor_named() async { |
53 addTestFile(''' | 50 addTestFile(''' |
54 class A { | 51 class A { |
55 A.named(p); | 52 A.named(p); |
56 } | 53 } |
57 main() { | 54 main() { |
58 new A.named(1); | 55 new A.named(1); |
59 new A.named(2); | 56 new A.named(2); |
60 } | 57 } |
61 '''); | 58 '''); |
(...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
669 T m() => null; | 666 T m() => null; |
670 } | 667 } |
671 '''); | 668 '''); |
672 await findElementReferences('T> {', false); | 669 await findElementReferences('T> {', false); |
673 expect(searchElement.kind, ElementKind.TYPE_PARAMETER); | 670 expect(searchElement.kind, ElementKind.TYPE_PARAMETER); |
674 expect(results, hasLength(2)); | 671 expect(results, hasLength(2)); |
675 assertHasResult(SearchResultKind.REFERENCE, 'T f;'); | 672 assertHasResult(SearchResultKind.REFERENCE, 'T f;'); |
676 assertHasResult(SearchResultKind.REFERENCE, 'T m()'); | 673 assertHasResult(SearchResultKind.REFERENCE, 'T m()'); |
677 } | 674 } |
678 } | 675 } |
OLD | NEW |