Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(96)

Side by Side Diff: pkg/analysis_server/test/services/completion/keyword_contributor_test.dart

Issue 1084233003: suggest this keyword in constructor param list (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: merge Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « pkg/analysis_server/lib/src/services/completion/keyword_contributor.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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.keyword; 5 library test.services.completion.dart.keyword;
6 6
7 import 'package:analysis_server/src/protocol.dart'; 7 import 'package:analysis_server/src/protocol.dart';
8 import 'package:analysis_server/src/services/completion/dart_completion_manager. dart'; 8 import 'package:analysis_server/src/services/completion/dart_completion_manager. dart';
9 import 'package:analysis_server/src/services/completion/keyword_contributor.dart '; 9 import 'package:analysis_server/src/services/completion/keyword_contributor.dart ';
10 import 'package:analyzer/src/generated/scanner.dart'; 10 import 'package:analyzer/src/generated/scanner.dart';
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 expect(computeFast(), isTrue); 330 expect(computeFast(), isTrue);
331 assertSuggestKeywords([Keyword.IMPLEMENTS], DART_RELEVANCE_HIGH); 331 assertSuggestKeywords([Keyword.IMPLEMENTS], DART_RELEVANCE_HIGH);
332 } 332 }
333 333
334 test_class_with_name() { 334 test_class_with_name() {
335 addTestSource('class A extends foo with ^'); 335 addTestSource('class A extends foo with ^');
336 expect(computeFast(), isTrue); 336 expect(computeFast(), isTrue);
337 assertSuggestKeywords([]); 337 assertSuggestKeywords([]);
338 } 338 }
339 339
340 test_constructor_param() {
341 addTestSource('class A { A(^) {});}');
342 expect(computeFast(), isTrue);
343 assertSuggestKeywords([Keyword.THIS]);
344 }
345
346 test_constructor_param2() {
347 addTestSource('class A { A(t^) {});}');
348 expect(computeFast(), isTrue);
349 assertSuggestKeywords([Keyword.THIS]);
350 }
351
340 test_empty() { 352 test_empty() {
341 addTestSource('^'); 353 addTestSource('^');
342 expect(computeFast(), isTrue); 354 expect(computeFast(), isTrue);
343 assertSuggestKeywords( 355 assertSuggestKeywords(
344 DIRECTIVE_DECLARATION_AND_LIBRARY_KEYWORDS, DART_RELEVANCE_HIGH); 356 DIRECTIVE_DECLARATION_AND_LIBRARY_KEYWORDS, DART_RELEVANCE_HIGH);
345 } 357 }
346 358
347 test_function_body_inClass_constructorInitializer() { 359 test_function_body_inClass_constructorInitializer() {
348 addTestSource(r''' 360 addTestSource(r'''
349 foo(p) {} 361 foo(p) {}
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
554 expect(computeFast(), isTrue); 566 expect(computeFast(), isTrue);
555 assertSuggestKeywords([]); 567 assertSuggestKeywords([]);
556 } 568 }
557 569
558 test_method_body() { 570 test_method_body() {
559 addTestSource('class A { foo() {^}}'); 571 addTestSource('class A { foo() {^}}');
560 expect(computeFast(), isTrue); 572 expect(computeFast(), isTrue);
561 assertSuggestKeywords(STMT_START_IN_CLASS); 573 assertSuggestKeywords(STMT_START_IN_CLASS);
562 } 574 }
563 575
576 test_method_param() {
577 addTestSource('class A { foo(^) {});}');
578 expect(computeFast(), isTrue);
579 assertNoSuggestions();
580 }
581
582 test_method_param2() {
583 addTestSource('class A { foo(t^) {});}');
584 expect(computeFast(), isTrue);
585 assertNoSuggestions();
586 }
587
564 test_named_constructor_invocation() { 588 test_named_constructor_invocation() {
565 addTestSource('void main() {new Future.^}'); 589 addTestSource('void main() {new Future.^}');
566 expect(computeFast(), isTrue); 590 expect(computeFast(), isTrue);
567 assertSuggestKeywords([]); 591 assertSuggestKeywords([]);
568 } 592 }
569 593
570 test_part_of() { 594 test_part_of() {
571 addTestSource('part of foo;^'); 595 addTestSource('part of foo;^');
572 expect(computeFast(), isTrue); 596 expect(computeFast(), isTrue);
573 assertSuggestKeywords( 597 assertSuggestKeywords(
(...skipping 20 matching lines...) Expand all
594 sorted.forEach((k) => msg.writeln(' Keyword.${k.name},')); 618 sorted.forEach((k) => msg.writeln(' Keyword.${k.name},'));
595 } 619 }
596 620
597 bool _equalSets(Iterable<Keyword> iter1, Iterable<Keyword> iter2) { 621 bool _equalSets(Iterable<Keyword> iter1, Iterable<Keyword> iter2) {
598 if (iter1.length != iter2.length) return false; 622 if (iter1.length != iter2.length) return false;
599 if (iter1.any((k) => !iter2.contains(k))) return false; 623 if (iter1.any((k) => !iter2.contains(k))) return false;
600 if (iter2.any((k) => !iter1.contains(k))) return false; 624 if (iter2.any((k) => !iter1.contains(k))) return false;
601 return true; 625 return true;
602 } 626 }
603 } 627 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/lib/src/services/completion/keyword_contributor.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698