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/plugin/protocol/protocol.dart'; | 9 import 'package:analysis_server/plugin/protocol/protocol.dart'; |
10 import 'package:analysis_server/src/domain_completion.dart'; | 10 import 'package:analysis_server/src/domain_completion.dart'; |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 | 303 |
304 test_inDartDoc2() async { | 304 test_inDartDoc2() async { |
305 addTestFile(''' | 305 addTestFile(''' |
306 /// Some text^ | 306 /// Some text^ |
307 main(aaa, bbb) {} | 307 main(aaa, bbb) {} |
308 '''); | 308 '''); |
309 await getSuggestions(); | 309 await getSuggestions(); |
310 expect(suggestions, isEmpty); | 310 expect(suggestions, isEmpty); |
311 } | 311 } |
312 | 312 |
313 fail_inDartDoc_reference1() async { | 313 test_inDartDoc_reference1() async { |
314 addFile( | 314 addFile( |
315 '/testA.dart', | 315 '/testA.dart', |
316 ''' | 316 ''' |
317 part of libA; | 317 part of libA; |
318 foo(bar) => 0;'''); | 318 foo(bar) => 0;'''); |
319 addTestFile(''' | 319 addTestFile(''' |
320 library libA; | 320 library libA; |
321 part "/testA.dart"; | 321 part "/testA.dart"; |
322 import "dart:math"; | 322 import "dart:math"; |
323 /// The [^] | 323 /// The [^] |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
491 return getSuggestions().then((_) { | 491 return getSuggestions().then((_) { |
492 expect(replacementOffset, equals(completionOffset)); | 492 expect(replacementOffset, equals(completionOffset)); |
493 expect(replacementLength, equals(0)); | 493 expect(replacementLength, equals(0)); |
494 assertHasResult(CompletionSuggestionKind.INVOCATION, 'Object'); | 494 assertHasResult(CompletionSuggestionKind.INVOCATION, 'Object'); |
495 assertHasResult(CompletionSuggestionKind.INVOCATION, 'HtmlElement'); | 495 assertHasResult(CompletionSuggestionKind.INVOCATION, 'HtmlElement'); |
496 assertHasResult(CompletionSuggestionKind.INVOCATION, 'A'); | 496 assertHasResult(CompletionSuggestionKind.INVOCATION, 'A'); |
497 assertNoResult('test'); | 497 assertNoResult('test'); |
498 }); | 498 }); |
499 } | 499 } |
500 | 500 |
501 fail_partFile2() { | 501 test_partFile2() { |
502 addFile( | 502 addFile( |
503 '/testA.dart', | 503 '/testA.dart', |
504 ''' | 504 ''' |
505 part of libA; | 505 part of libA; |
506 class A { }'''); | 506 class A { }'''); |
507 addTestFile(''' | 507 addTestFile(''' |
508 library libA; | 508 library libA; |
509 part "/testA.dart"; | 509 part "/testA.dart"; |
510 import 'dart:html'; | 510 import 'dart:html'; |
511 main() {^} | 511 main() {^} |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
606 } | 606 } |
607 '''); | 607 '''); |
608 await waitForTasksFinished(); | 608 await waitForTasksFinished(); |
609 Request request = | 609 Request request = |
610 new CompletionGetSuggestionsParams(testFile, 0).toRequest('0'); | 610 new CompletionGetSuggestionsParams(testFile, 0).toRequest('0'); |
611 Response response = handler.handleRequest(request); | 611 Response response = handler.handleRequest(request); |
612 expect(response.error, isNotNull); | 612 expect(response.error, isNotNull); |
613 expect(response.error.code, RequestErrorCode.NO_INDEX_GENERATED); | 613 expect(response.error.code, RequestErrorCode.NO_INDEX_GENERATED); |
614 } | 614 } |
615 } | 615 } |
OLD | NEW |