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.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 Loading... |
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 Loading... |
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 } |
OLD | NEW |