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.search.abstract_search_domain; | 5 library test.search.abstract_search_domain; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 | 8 |
9 import 'package:analysis_server/plugin/protocol/protocol.dart'; | 9 import 'package:analysis_server/plugin/protocol/protocol.dart'; |
10 import 'package:analysis_server/src/constants.dart'; | 10 import 'package:analysis_server/src/constants.dart'; |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 } | 59 } |
60 if (expected) { | 60 if (expected) { |
61 fail( | 61 fail( |
62 'Not found: "search" kind=$kind offset=$offset length=$length\nin\n' + | 62 'Not found: "search" kind=$kind offset=$offset length=$length\nin\n' + |
63 results.join('\n')); | 63 results.join('\n')); |
64 } | 64 } |
65 } | 65 } |
66 | 66 |
67 String getPathString(List<Element> path) { | 67 String getPathString(List<Element> path) { |
68 return path.map((Element element) { | 68 return path.map((Element element) { |
69 return '${element.kind.name} ${element.name}'; | 69 String kindName = element.kind.name; |
| 70 String name = element.name; |
| 71 if (name.isEmpty) { |
| 72 return kindName; |
| 73 } else { |
| 74 return '$kindName $name'; |
| 75 } |
70 }).join('\n'); | 76 }).join('\n'); |
71 } | 77 } |
72 | 78 |
73 @override | 79 @override |
74 void processNotification(Notification notification) { | 80 void processNotification(Notification notification) { |
75 if (notification.event == SEARCH_RESULTS) { | 81 if (notification.event == SEARCH_RESULTS) { |
76 var params = new SearchResultsParams.fromNotification(notification); | 82 var params = new SearchResultsParams.fromNotification(notification); |
77 String id = params.id; | 83 String id = params.id; |
78 _ResultSet resultSet = resultSets[id]; | 84 _ResultSet resultSet = resultSets[id]; |
79 if (resultSet == null) { | 85 if (resultSet == null) { |
(...skipping 22 matching lines...) Expand all Loading... |
102 } | 108 } |
103 } | 109 } |
104 | 110 |
105 class _ResultSet { | 111 class _ResultSet { |
106 final String id; | 112 final String id; |
107 final List<SearchResult> results = <SearchResult>[]; | 113 final List<SearchResult> results = <SearchResult>[]; |
108 bool done = false; | 114 bool done = false; |
109 | 115 |
110 _ResultSet(this.id); | 116 _ResultSet(this.id); |
111 } | 117 } |
OLD | NEW |