| 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.dart.util; | 5 library test.services.completion.dart.util; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'package:analysis_server/plugin/protocol/protocol.dart' as protocol | 9 import 'package:analysis_server/plugin/protocol/protocol.dart' as protocol |
| 10 show Element, ElementKind; | 10 show Element, ElementKind; |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 } | 103 } |
| 104 | 104 |
| 105 CompletionSuggestion assertSuggest(String completion, | 105 CompletionSuggestion assertSuggest(String completion, |
| 106 {CompletionSuggestionKind csKind: CompletionSuggestionKind.INVOCATION, | 106 {CompletionSuggestionKind csKind: CompletionSuggestionKind.INVOCATION, |
| 107 int relevance: DART_RELEVANCE_DEFAULT, | 107 int relevance: DART_RELEVANCE_DEFAULT, |
| 108 String importUri, | 108 String importUri, |
| 109 protocol.ElementKind elemKind: null, | 109 protocol.ElementKind elemKind: null, |
| 110 bool isDeprecated: false, | 110 bool isDeprecated: false, |
| 111 bool isPotential: false, | 111 bool isPotential: false, |
| 112 String elemFile, | 112 String elemFile, |
| 113 int elemOffset}) { | 113 int elemOffset, |
| 114 String paramName, |
| 115 String paramType}) { |
| 114 CompletionSuggestion cs = | 116 CompletionSuggestion cs = |
| 115 getSuggest(completion: completion, csKind: csKind, elemKind: elemKind); | 117 getSuggest(completion: completion, csKind: csKind, elemKind: elemKind); |
| 116 if (cs == null) { | 118 if (cs == null) { |
| 117 failedCompletion('expected $completion $csKind $elemKind', suggestions); | 119 failedCompletion('expected $completion $csKind $elemKind', suggestions); |
| 118 } | 120 } |
| 119 expect(cs.kind, equals(csKind)); | 121 expect(cs.kind, equals(csKind)); |
| 120 if (isDeprecated) { | 122 if (isDeprecated) { |
| 121 expect(cs.relevance, equals(DART_RELEVANCE_LOW)); | 123 expect(cs.relevance, equals(DART_RELEVANCE_LOW)); |
| 122 } else { | 124 } else { |
| 123 expect(cs.relevance, equals(relevance), reason: completion); | 125 expect(cs.relevance, equals(relevance), reason: completion); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 134 expect(cs.element.location.length, isNotNull); | 136 expect(cs.element.location.length, isNotNull); |
| 135 expect(cs.element.location.startColumn, isNotNull); | 137 expect(cs.element.location.startColumn, isNotNull); |
| 136 expect(cs.element.location.startLine, isNotNull); | 138 expect(cs.element.location.startLine, isNotNull); |
| 137 } | 139 } |
| 138 if (elemFile != null) { | 140 if (elemFile != null) { |
| 139 expect(cs.element.location.file, elemFile); | 141 expect(cs.element.location.file, elemFile); |
| 140 } | 142 } |
| 141 if (elemOffset != null) { | 143 if (elemOffset != null) { |
| 142 expect(cs.element.location.offset, elemOffset); | 144 expect(cs.element.location.offset, elemOffset); |
| 143 } | 145 } |
| 146 if(paramName != null) { |
| 147 expect(cs.parameterName, paramName); |
| 148 } |
| 149 if(paramType != null) { |
| 150 expect(cs.parameterType, paramType); |
| 151 } |
| 144 return cs; | 152 return cs; |
| 145 } | 153 } |
| 146 | 154 |
| 147 CompletionSuggestion assertSuggestClass(String name, | 155 CompletionSuggestion assertSuggestClass(String name, |
| 148 {int relevance: DART_RELEVANCE_DEFAULT, | 156 {int relevance: DART_RELEVANCE_DEFAULT, |
| 149 String importUri, | 157 String importUri, |
| 150 CompletionSuggestionKind kind: CompletionSuggestionKind.INVOCATION, | 158 CompletionSuggestionKind kind: CompletionSuggestionKind.INVOCATION, |
| 151 bool isDeprecated: false, | 159 bool isDeprecated: false, |
| 152 String elemFile, | 160 String elemFile, |
| 153 String elemName, | 161 String elemName, |
| (...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 542 } | 550 } |
| 543 | 551 |
| 544 @override | 552 @override |
| 545 void setUp() { | 553 void setUp() { |
| 546 super.setUp(); | 554 super.setUp(); |
| 547 index = createMemoryIndex(); | 555 index = createMemoryIndex(); |
| 548 searchEngine = new SearchEngineImpl(index); | 556 searchEngine = new SearchEngineImpl(index); |
| 549 contributor = createContributor(); | 557 contributor = createContributor(); |
| 550 } | 558 } |
| 551 } | 559 } |
| OLD | NEW |