| 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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 }); | 165 }); |
| 166 } | 166 } |
| 167 | 167 |
| 168 test_locals() { | 168 test_locals() { |
| 169 addTestFile('class A {var a; x() {var b;^}}'); | 169 addTestFile('class A {var a; x() {var b;^}}'); |
| 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.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_topLevel() { | 180 test_topLevel() { |
| 181 addTestFile(''' | 181 addTestFile(''' |
| 182 typedef foo(); | 182 typedef foo(); |
| 183 var test = ''; | 183 var test = ''; |
| 184 main() {tes^t} | 184 main() {tes^t} |
| 185 '''); | 185 '''); |
| 186 return getSuggestions().then((_) { | 186 return getSuggestions().then((_) { |
| 187 // expect(replacementOffset, equals(completionOffset - 3)); | 187 // expect(replacementOffset, equals(completionOffset - 3)); |
| 188 // expect(replacementLength, equals(4)); | 188 // expect(replacementLength, equals(4)); |
| 189 assertHasResult(CompletionSuggestionKind.CLASS, 'Object'); | 189 assertHasResult(CompletionSuggestionKind.CLASS, 'Object'); |
| 190 assertHasResult(CompletionSuggestionKind.TOP_LEVEL_VARIABLE, 'test'); | 190 assertHasResult(CompletionSuggestionKind.TOP_LEVEL_VARIABLE, 'test'); |
| 191 assertNoResult('HtmlElement'); | 191 assertNoResult('HtmlElement'); |
| 192 }); | 192 }); |
| 193 } | 193 } |
| 194 } | 194 } |
| OLD | NEW |