Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(363)

Unified Diff: pkg/analysis_server/test/search/type_hierarchy_test.dart

Issue 1322323005: Support for 'superOnly' in 'search.getTypeHierarchy'. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analysis_server/lib/src/search/type_hierarchy.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/test/search/type_hierarchy_test.dart
diff --git a/pkg/analysis_server/test/search/type_hierarchy_test.dart b/pkg/analysis_server/test/search/type_hierarchy_test.dart
index 3dda4791cd3a037620a83ef60e572a8fe2849689..67445aa8ecb42a775bcca15bcc2cc4889b452ba4 100644
--- a/pkg/analysis_server/test/search/type_hierarchy_test.dart
+++ b/pkg/analysis_server/test/search/type_hierarchy_test.dart
@@ -791,14 +791,86 @@ class D extends C {
itemD.memberElement.location.offset, findOffset('test(x) {} // in D'));
}
- Request _createGetTypeHierarchyRequest(String search) {
- return new SearchGetTypeHierarchyParams(testFile, findOffset(search))
- .toRequest(requestId);
+ test_superOnly() async {
+ addTestFile('''
+class A {}
+class B {}
+class C extends A implements B {}
+class D extends C {}
+''');
+ List<TypeHierarchyItem> items =
+ await _getTypeHierarchy('C extends', superOnly: true);
+ expect(_toJson(items), [
+ {
+ 'classElement': {
+ 'kind': 'CLASS',
+ 'name': 'C',
+ 'location': anything,
+ 'flags': 0
+ },
+ 'superclass': 1,
+ 'interfaces': [3],
+ 'mixins': [],
+ 'subclasses': []
+ },
+ {
+ 'classElement': {
+ 'kind': 'CLASS',
+ 'name': 'A',
+ 'location': anything,
+ 'flags': 0
+ },
+ 'superclass': 2,
+ 'interfaces': [],
+ 'mixins': [],
+ 'subclasses': []
+ },
+ {
+ 'classElement': {
+ 'kind': 'CLASS',
+ 'name': 'Object',
+ 'location': anything,
+ 'flags': 0
+ },
+ 'interfaces': [],
+ 'mixins': [],
+ 'subclasses': []
+ },
+ {
+ 'classElement': {
+ 'kind': 'CLASS',
+ 'name': 'B',
+ 'location': anything,
+ 'flags': 0
+ },
+ 'superclass': 2,
+ 'interfaces': [],
+ 'mixins': [],
+ 'subclasses': []
+ }
+ ]);
+ }
+
+ test_superOnly_fileDoesNotExist() async {
+ Request request = new SearchGetTypeHierarchyParams(
+ '/does/not/exist.dart', 0,
+ superOnly: true).toRequest(requestId);
+ Response response = await serverChannel.sendRequest(request);
+ List<TypeHierarchyItem> items =
+ new SearchGetTypeHierarchyResult.fromResponse(response).hierarchyItems;
+ expect(items, isNull);
+ }
+
+ Request _createGetTypeHierarchyRequest(String search, {bool superOnly}) {
+ return new SearchGetTypeHierarchyParams(testFile, findOffset(search),
+ superOnly: superOnly).toRequest(requestId);
}
- Future<List<TypeHierarchyItem>> _getTypeHierarchy(String search) async {
+ Future<List<TypeHierarchyItem>> _getTypeHierarchy(String search,
+ {bool superOnly}) async {
await waitForTasksFinished();
- Request request = _createGetTypeHierarchyRequest(search);
+ Request request =
+ _createGetTypeHierarchyRequest(search, superOnly: superOnly);
Response response = await serverChannel.sendRequest(request);
expect(serverErrors, isEmpty);
return new SearchGetTypeHierarchyResult.fromResponse(response)
« no previous file with comments | « pkg/analysis_server/lib/src/search/type_hierarchy.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698