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

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

Issue 501043002: Extract 'toJson' in TH test. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 4 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 | « no previous file | 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 87f88f3ef7b6b73e6ac8ec8f0cd2706c9ab564a3..d542fb85802018cbbf49124aab65bf626366b43f 100644
--- a/pkg/analysis_server/test/search/type_hierarchy_test.dart
+++ b/pkg/analysis_server/test/search/type_hierarchy_test.dart
@@ -59,7 +59,7 @@ class B extends A {
''');
return waitForTasksFinished().then((_) {
return _getTypeHierarchy('B extends A').then((items) {
- expect(items.map((item) => item.toJson()).toList(), [{
+ expect(_toJson(items), [{
'classElement': {
'kind': 'CLASS',
'name': 'B',
@@ -114,7 +114,7 @@ class C extends B {
''');
return waitForTasksFinished().then((_) {
return _getTypeHierarchy('A {}').then((items) {
- expect(items.map((item) => item.toJson()).toList(), [{
+ expect(_toJson(items), [{
'classElement': {
'kind': 'CLASS',
'name': 'A',
@@ -173,7 +173,7 @@ class C extends B {
''');
return waitForTasksFinished().then((_) {
return _getTypeHierarchy('B extends').then((items) {
- expect(items.map((item) => item.toJson()).toList(), [{
+ expect(_toJson(items), [{
'classElement': {
'kind': 'CLASS',
'name': 'B',
@@ -232,7 +232,7 @@ class C extends B {
''');
return waitForTasksFinished().then((_) {
return _getTypeHierarchy('C extends').then((items) {
- expect(items.map((item) => item.toJson()).toList(), [{
+ expect(_toJson(items), [{
'classElement': {
'kind': 'CLASS',
'name': 'C',
@@ -291,7 +291,7 @@ class T implements MA, MB {
''');
return waitForTasksFinished().then((_) {
return _getTypeHierarchy('T implements').then((items) {
- expect(items.map((item) => item.toJson()).toList(), [{
+ expect(_toJson(items), [{
'classElement': {
'kind': 'CLASS',
'name': 'T',
@@ -350,7 +350,7 @@ class T extends Object with MA, MB {
''');
return waitForTasksFinished().then((_) {
return _getTypeHierarchy('T extends Object').then((items) {
- expect(items.map((item) => item.toJson()).toList(), [{
+ expect(_toJson(items), [{
'classElement': {
'kind': 'CLASS',
'name': 'T',
@@ -551,14 +551,20 @@ class D extends C {
}
Request _createGetTypeHierarchyRequest(String search) {
- return new SearchGetTypeHierarchyParams(testFile,
+ return new SearchGetTypeHierarchyParams(
+ testFile,
findOffset(search)).toRequest(requestId);
}
Future<List<TypeHierarchyItem>> _getTypeHierarchy(String search) {
Request request = _createGetTypeHierarchyRequest(search);
return serverChannel.sendRequest(request).then((Response response) {
- return new SearchGetTypeHierarchyResult.fromResponse(response).hierarchyItems;
+ return new SearchGetTypeHierarchyResult.fromResponse(
+ response).hierarchyItems;
});
}
+
+ List _toJson(List<TypeHierarchyItem> items) {
+ return items.map((item) => item.toJson()).toList();
+ }
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698