| 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.services.completion.util; | 5 library test.services.completion.util; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'package:analysis_server/src/protocol.dart' as protocol show Element, | 9 import 'package:analysis_server/src/protocol.dart' as protocol show Element, |
| 10 ElementKind; | 10 ElementKind; |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 return cs; | 136 return cs; |
| 137 } | 137 } |
| 138 | 138 |
| 139 CompletionSuggestion assertSuggestLibraryPrefix(String prefix, | 139 CompletionSuggestion assertSuggestLibraryPrefix(String prefix, |
| 140 [CompletionRelevance relevance = CompletionRelevance.DEFAULT]) { | 140 [CompletionRelevance relevance = CompletionRelevance.DEFAULT]) { |
| 141 CompletionSuggestion cs = | 141 CompletionSuggestion cs = |
| 142 assertSuggest(CompletionSuggestionKind.LIBRARY_PREFIX, prefix, relevance
); | 142 assertSuggest(CompletionSuggestionKind.LIBRARY_PREFIX, prefix, relevance
); |
| 143 protocol.Element element = cs.element; | 143 protocol.Element element = cs.element; |
| 144 expect(element, isNotNull); | 144 expect(element, isNotNull); |
| 145 expect(element.kind, equals(protocol.ElementKind.LIBRARY)); | 145 expect(element.kind, equals(protocol.ElementKind.LIBRARY)); |
| 146 expect(element.name, equals(prefix)); | |
| 147 expect(element.returnType, isNull); | 146 expect(element.returnType, isNull); |
| 148 return cs; | 147 return cs; |
| 149 } | 148 } |
| 150 | 149 |
| 151 CompletionSuggestion assertSuggestLocalVariable(String name, | 150 CompletionSuggestion assertSuggestLocalVariable(String name, |
| 152 String returnType, [CompletionRelevance relevance = | 151 String returnType, [CompletionRelevance relevance = |
| 153 CompletionRelevance.DEFAULT]) { | 152 CompletionRelevance.DEFAULT]) { |
| 154 CompletionSuggestion cs = | 153 CompletionSuggestion cs = |
| 155 assertSuggest(CompletionSuggestionKind.LOCAL_VARIABLE, name, relevance); | 154 assertSuggest(CompletionSuggestionKind.LOCAL_VARIABLE, name, relevance); |
| 156 expect(cs.returnType, equals(returnType)); | 155 expect(cs.returnType, equals(returnType)); |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 sb.write('\n in'); | 309 sb.write('\n in'); |
| 311 AstNode node = completionNode; | 310 AstNode node = completionNode; |
| 312 while (node != null) { | 311 while (node != null) { |
| 313 sb.write('\n ${node.runtimeType}'); | 312 sb.write('\n ${node.runtimeType}'); |
| 314 node = node.parent; | 313 node = node.parent; |
| 315 } | 314 } |
| 316 } | 315 } |
| 317 fail(sb.toString()); | 316 fail(sb.toString()); |
| 318 } | 317 } |
| 319 } | 318 } |
| OLD | NEW |