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

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

Issue 1963323003: More tweaks for 'for' completion. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 7 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
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/plugin/protocol/protocol.dart'; 7 import 'package:analysis_server/plugin/protocol/protocol.dart';
8 import 'package:analysis_server/src/provisional/completion/dart/completion_dart. dart'; 8 import 'package:analysis_server/src/provisional/completion/dart/completion_dart. dart';
9 import 'package:analysis_server/src/services/completion/dart/keyword_contributor .dart'; 9 import 'package:analysis_server/src/services/completion/dart/keyword_contributor .dart';
10 import 'package:analyzer/dart/ast/token.dart'; 10 import 'package:analyzer/dart/ast/token.dart';
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after
651 await computeSuggestions(); 651 await computeSuggestions();
652 assertSuggestKeywords([Keyword.IN], relevance: DART_RELEVANCE_HIGH); 652 assertSuggestKeywords([Keyword.IN], relevance: DART_RELEVANCE_HIGH);
653 } 653 }
654 654
655 test_for_expression_in2() async { 655 test_for_expression_in2() async {
656 addTestSource('main() {for (int x in^)}'); 656 addTestSource('main() {for (int x in^)}');
657 await computeSuggestions(); 657 await computeSuggestions();
658 assertSuggestKeywords([Keyword.IN], relevance: DART_RELEVANCE_HIGH); 658 assertSuggestKeywords([Keyword.IN], relevance: DART_RELEVANCE_HIGH);
659 } 659 }
660 660
661 test_for_expression_in_inInitializer() async {
662 addTestSource('main() {for (int i^)}');
663 await computeSuggestions();
664 assertSuggestKeywords([]);
665 }
666
661 test_for_expression_init() async { 667 test_for_expression_init() async {
662 addTestSource('main() {for (int x = i^)}'); 668 addTestSource('main() {for (int x = i^)}');
663 await computeSuggestions(); 669 await computeSuggestions();
664 assertSuggestKeywords(EXPRESSION_START_NO_INSTANCE); 670 assertSuggestKeywords(EXPRESSION_START_NO_INSTANCE);
665 } 671 }
666 672
667 test_for_expression_init2() async { 673 test_for_expression_init2() async {
668 addTestSource('main() {for (int x = in^)}'); 674 addTestSource('main() {for (int x = in^)}');
669 await computeSuggestions(); 675 await computeSuggestions();
670 assertSuggestKeywords(EXPRESSION_START_NO_INSTANCE); 676 assertSuggestKeywords(EXPRESSION_START_NO_INSTANCE);
671 } 677 }
672 678
673 test_for_initialization_var() async { 679 test_for_initialization_var() async {
674 addTestSource('main() {for (va^)}'); 680 addTestSource('main() {for (^)}');
675 await computeSuggestions(); 681 await computeSuggestions();
676 assertSuggestKeywords([Keyword.FINAL, Keyword.VAR], 682 assertSuggestKeywords([Keyword.VAR], relevance: DART_RELEVANCE_HIGH);
677 relevance: DART_RELEVANCE_HIGH);
678 } 683 }
679 684
680 test_function_async() async { 685 test_function_async() async {
681 addTestSource('main()^'); 686 addTestSource('main()^');
682 await computeSuggestions(); 687 await computeSuggestions();
683 assertSuggestKeywords(DECLARATION_KEYWORDS, 688 assertSuggestKeywords(DECLARATION_KEYWORDS,
684 pseudoKeywords: ['async', 'async*', 'sync*'], 689 pseudoKeywords: ['async', 'async*', 'sync*'],
685 relevance: DART_RELEVANCE_HIGH); 690 relevance: DART_RELEVANCE_HIGH);
686 } 691 }
687 692
(...skipping 825 matching lines...) Expand 10 before | Expand all | Expand 10 after
1513 (c) => msg.writeln(' $c, ${other.contains(c) ? '' : '<<<<<<<<<<<'}')); 1518 (c) => msg.writeln(' $c, ${other.contains(c) ? '' : '<<<<<<<<<<<'}'));
1514 } 1519 }
1515 1520
1516 bool _equalSets(Iterable<String> iter1, Iterable<String> iter2) { 1521 bool _equalSets(Iterable<String> iter1, Iterable<String> iter2) {
1517 if (iter1.length != iter2.length) return false; 1522 if (iter1.length != iter2.length) return false;
1518 if (iter1.any((c) => !iter2.contains(c))) return false; 1523 if (iter1.any((c) => !iter2.contains(c))) return false;
1519 if (iter2.any((c) => !iter1.contains(c))) return false; 1524 if (iter2.any((c) => !iter1.contains(c))) return false;
1520 return true; 1525 return true;
1521 } 1526 }
1522 } 1527 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698