| 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/protocol/protocol.dart'; | 9 import 'package:analysis_server/protocol/protocol.dart'; |
| 10 import 'package:analysis_server/protocol/protocol_generated.dart'; | 10 import 'package:analysis_server/protocol/protocol_generated.dart'; |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 test_catch5() async { | 173 test_catch5() async { |
| 174 addTestFile('main() {try {} ^ finally {}}'); | 174 addTestFile('main() {try {} ^ finally {}}'); |
| 175 await getSuggestions(); | 175 await getSuggestions(); |
| 176 assertHasResult(CompletionSuggestionKind.KEYWORD, 'on', | 176 assertHasResult(CompletionSuggestionKind.KEYWORD, 'on', |
| 177 relevance: DART_RELEVANCE_KEYWORD); | 177 relevance: DART_RELEVANCE_KEYWORD); |
| 178 assertHasResult(CompletionSuggestionKind.KEYWORD, 'catch', | 178 assertHasResult(CompletionSuggestionKind.KEYWORD, 'catch', |
| 179 relevance: DART_RELEVANCE_KEYWORD); | 179 relevance: DART_RELEVANCE_KEYWORD); |
| 180 expect(suggestions, hasLength(2)); | 180 expect(suggestions, hasLength(2)); |
| 181 } | 181 } |
| 182 | 182 |
| 183 test_constructor() async { |
| 184 addTestFile('class A {bool foo; A() : ^;}'); |
| 185 await getSuggestions(); |
| 186 assertHasResult(CompletionSuggestionKind.KEYWORD, 'super', |
| 187 relevance: DART_RELEVANCE_KEYWORD); |
| 188 assertHasResult(CompletionSuggestionKind.INVOCATION, 'foo', |
| 189 relevance: DART_RELEVANCE_LOCAL_FIELD); |
| 190 } |
| 191 |
| 192 test_constructor2() async { |
| 193 addTestFile('class A {bool foo; A() : s^;}'); |
| 194 await getSuggestions(); |
| 195 assertHasResult(CompletionSuggestionKind.KEYWORD, 'super', |
| 196 relevance: DART_RELEVANCE_KEYWORD); |
| 197 assertHasResult(CompletionSuggestionKind.INVOCATION, 'foo', |
| 198 relevance: DART_RELEVANCE_LOCAL_FIELD); |
| 199 } |
| 200 |
| 201 test_constructor3() async { |
| 202 addTestFile('class A {bool foo; A() : a=7,^;}'); |
| 203 await getSuggestions(); |
| 204 assertHasResult(CompletionSuggestionKind.KEYWORD, 'super', |
| 205 relevance: DART_RELEVANCE_KEYWORD); |
| 206 assertHasResult(CompletionSuggestionKind.INVOCATION, 'foo', |
| 207 relevance: DART_RELEVANCE_LOCAL_FIELD); |
| 208 } |
| 209 |
| 210 test_constructor4() async { |
| 211 addTestFile('class A {bool foo; A() : a=7,s^;}'); |
| 212 await getSuggestions(); |
| 213 assertHasResult(CompletionSuggestionKind.KEYWORD, 'super', |
| 214 relevance: DART_RELEVANCE_KEYWORD); |
| 215 assertHasResult(CompletionSuggestionKind.INVOCATION, 'foo', |
| 216 relevance: DART_RELEVANCE_LOCAL_FIELD); |
| 217 } |
| 218 |
| 219 test_constructor5() async { |
| 220 addTestFile('class A {bool foo; A() : a=7,s^}'); |
| 221 await getSuggestions(); |
| 222 assertHasResult(CompletionSuggestionKind.KEYWORD, 'super', |
| 223 relevance: DART_RELEVANCE_KEYWORD); |
| 224 assertHasResult(CompletionSuggestionKind.INVOCATION, 'foo', |
| 225 relevance: DART_RELEVANCE_LOCAL_FIELD); |
| 226 } |
| 227 |
| 228 test_constructor6() async { |
| 229 addTestFile('class A {bool foo; A() : a=7,^ void bar() {}}'); |
| 230 await getSuggestions(); |
| 231 assertHasResult(CompletionSuggestionKind.KEYWORD, 'super', |
| 232 relevance: DART_RELEVANCE_KEYWORD); |
| 233 assertHasResult(CompletionSuggestionKind.INVOCATION, 'foo', |
| 234 relevance: DART_RELEVANCE_LOCAL_FIELD); |
| 235 } |
| 236 |
| 183 @failingTest | 237 @failingTest |
| 184 test_html() { | 238 test_html() { |
| 185 // | 239 // |
| 186 // We no longer support the analysis of non-dart files. | 240 // We no longer support the analysis of non-dart files. |
| 187 // | 241 // |
| 188 testFile = '/project/web/test.html'; | 242 testFile = '/project/web/test.html'; |
| 189 addTestFile(''' | 243 addTestFile(''' |
| 190 <html>^</html> | 244 <html>^</html> |
| 191 '''); | 245 '''); |
| 192 return getSuggestions().then((_) { | 246 return getSuggestions().then((_) { |
| (...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 750 } | 804 } |
| 751 '''); | 805 '''); |
| 752 await waitForTasksFinished(); | 806 await waitForTasksFinished(); |
| 753 Request request = | 807 Request request = |
| 754 new CompletionGetSuggestionsParams(testFile, 0).toRequest('0'); | 808 new CompletionGetSuggestionsParams(testFile, 0).toRequest('0'); |
| 755 Response response = handler.handleRequest(request); | 809 Response response = handler.handleRequest(request); |
| 756 expect(response.error, isNotNull); | 810 expect(response.error, isNotNull); |
| 757 expect(response.error.code, RequestErrorCode.NO_INDEX_GENERATED); | 811 expect(response.error.code, RequestErrorCode.NO_INDEX_GENERATED); |
| 758 } | 812 } |
| 759 } | 813 } |
| OLD | NEW |