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

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

Issue 1147213008: suggest keywords in if expression (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: merge Created 5 years, 6 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
« 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 628 matching lines...) Expand 10 before | Expand all | Expand 10 after
639 expect(computeFast(), isTrue); 639 expect(computeFast(), isTrue);
640 assertSuggestKeywords(STMT_START_OUTSIDE_CLASS); 640 assertSuggestKeywords(STMT_START_OUTSIDE_CLASS);
641 } 641 }
642 642
643 test_function_body_inUnit_async() { 643 test_function_body_inUnit_async() {
644 addTestSource('main() async {^}'); 644 addTestSource('main() async {^}');
645 expect(computeFast(), isTrue); 645 expect(computeFast(), isTrue);
646 assertSuggestKeywords(STMT_START_OUTSIDE_CLASS, pseudoKeywords: ['await']); 646 assertSuggestKeywords(STMT_START_OUTSIDE_CLASS, pseudoKeywords: ['await']);
647 } 647 }
648 648
649 test_if_expression_in_class() {
650 addTestSource('class A {foo() {if (^) }}');
651 expect(computeFast(), isTrue);
652 assertSuggestKeywords(EXPRESSION_START_INSTANCE);
653 }
654
655 test_if_expression_in_class2() {
656 addTestSource('class A {foo() {if (n^) }}');
657 expect(computeFast(), isTrue);
658 assertSuggestKeywords(EXPRESSION_START_INSTANCE);
659 }
660
661 test_if_expression_in_function() {
662 addTestSource('foo() {if (^) }');
663 expect(computeFast(), isTrue);
664 assertSuggestKeywords(EXPRESSION_START_NO_INSTANCE);
665 }
666
667 test_if_expression_in_function2() {
668 addTestSource('foo() {if (n^) }');
669 expect(computeFast(), isTrue);
670 assertSuggestKeywords(EXPRESSION_START_NO_INSTANCE);
671 }
672
649 test_if_in_class() { 673 test_if_in_class() {
650 addTestSource('class A {foo() {if (true) ^}}'); 674 addTestSource('class A {foo() {if (true) ^}}');
651 expect(computeFast(), isTrue); 675 expect(computeFast(), isTrue);
652 assertSuggestKeywords(STMT_START_IN_CLASS); 676 assertSuggestKeywords(STMT_START_IN_CLASS);
653 } 677 }
654 678
655 test_if_in_class2() { 679 test_if_in_class2() {
656 addTestSource('class A {foo() {if (true) ^;}}'); 680 addTestSource('class A {foo() {if (true) ^;}}');
657 expect(computeFast(), isTrue); 681 expect(computeFast(), isTrue);
658 assertSuggestKeywords(STMT_START_IN_CLASS); 682 assertSuggestKeywords(STMT_START_IN_CLASS);
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after
1104 (c) => msg.writeln(' $c, ${other.contains(c) ? '' : '<<<<<<<<<<<'}')); 1128 (c) => msg.writeln(' $c, ${other.contains(c) ? '' : '<<<<<<<<<<<'}'));
1105 } 1129 }
1106 1130
1107 bool _equalSets(Iterable<String> iter1, Iterable<String> iter2) { 1131 bool _equalSets(Iterable<String> iter1, Iterable<String> iter2) {
1108 if (iter1.length != iter2.length) return false; 1132 if (iter1.length != iter2.length) return false;
1109 if (iter1.any((c) => !iter2.contains(c))) return false; 1133 if (iter1.any((c) => !iter2.contains(c))) return false;
1110 if (iter2.any((c) => !iter1.contains(c))) return false; 1134 if (iter2.any((c) => !iter1.contains(c))) return false;
1111 return true; 1135 return true;
1112 } 1136 }
1113 } 1137 }
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