| 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.domain.completion; | 5 library test.domain.completion; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'package:analysis_server/src/constants.dart'; | 9 import 'package:analysis_server/src/constants.dart'; |
| 10 import 'package:analysis_server/src/domain_completion.dart'; | 10 import 'package:analysis_server/src/domain_completion.dart'; |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 return getSuggestions().then((_) { | 170 return getSuggestions().then((_) { |
| 171 expect(replacementOffset, equals(completionOffset)); | 171 expect(replacementOffset, equals(completionOffset)); |
| 172 expect(replacementLength, equals(0)); | 172 expect(replacementLength, equals(0)); |
| 173 assertHasResult(CompletionSuggestionKind.CLASS, 'A'); | 173 assertHasResult(CompletionSuggestionKind.CLASS, 'A'); |
| 174 assertHasResult(CompletionSuggestionKind.FIELD, 'a'); | 174 assertHasResult(CompletionSuggestionKind.FIELD, 'a'); |
| 175 assertHasResult(CompletionSuggestionKind.LOCAL_VARIABLE, 'b'); | 175 assertHasResult(CompletionSuggestionKind.LOCAL_VARIABLE, 'b'); |
| 176 assertHasResult(CompletionSuggestionKind.METHOD_NAME, 'x'); | 176 assertHasResult(CompletionSuggestionKind.METHOD_NAME, 'x'); |
| 177 }); | 177 }); |
| 178 } | 178 } |
| 179 | 179 |
| 180 test_invocation() { |
| 181 addTestFile('class A {b() {}} main() {A a; a.^}'); |
| 182 return getSuggestions().then((_) { |
| 183 expect(replacementOffset, equals(completionOffset)); |
| 184 expect(replacementLength, equals(0)); |
| 185 assertHasResult(CompletionSuggestionKind.METHOD, 'b'); |
| 186 }); |
| 187 } |
| 188 |
| 180 test_topLevel() { | 189 test_topLevel() { |
| 181 addTestFile(''' | 190 addTestFile(''' |
| 182 typedef foo(); | 191 typedef foo(); |
| 183 var test = ''; | 192 var test = ''; |
| 184 main() {tes^t} | 193 main() {tes^t} |
| 185 '''); | 194 '''); |
| 186 return getSuggestions().then((_) { | 195 return getSuggestions().then((_) { |
| 187 // expect(replacementOffset, equals(completionOffset - 3)); | 196 // expect(replacementOffset, equals(completionOffset - 3)); |
| 188 // expect(replacementLength, equals(4)); | 197 // expect(replacementLength, equals(4)); |
| 189 assertHasResult(CompletionSuggestionKind.CLASS, 'Object'); | 198 assertHasResult(CompletionSuggestionKind.CLASS, 'Object'); |
| 190 assertHasResult(CompletionSuggestionKind.TOP_LEVEL_VARIABLE, 'test'); | 199 assertHasResult(CompletionSuggestionKind.TOP_LEVEL_VARIABLE, 'test'); |
| 191 assertNoResult('HtmlElement'); | 200 assertNoResult('HtmlElement'); |
| 192 }); | 201 }); |
| 193 } | 202 } |
| 194 } | 203 } |
| OLD | NEW |