| 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 724 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 735 | 735 |
| 736 test_if_outside_class4() { | 736 test_if_outside_class4() { |
| 737 addTestSource('foo() {if (true) ^ go();}'); | 737 addTestSource('foo() {if (true) ^ go();}'); |
| 738 expect(computeFast(), isTrue); | 738 expect(computeFast(), isTrue); |
| 739 assertSuggestKeywords(STMT_START_OUTSIDE_CLASS); | 739 assertSuggestKeywords(STMT_START_OUTSIDE_CLASS); |
| 740 } | 740 } |
| 741 | 741 |
| 742 test_import() { | 742 test_import() { |
| 743 addTestSource('import "foo" deferred as foo ^;'); | 743 addTestSource('import "foo" deferred as foo ^;'); |
| 744 expect(computeFast(), isTrue); | 744 expect(computeFast(), isTrue); |
| 745 assertSuggestKeywords([], relevance: DART_RELEVANCE_HIGH); | 745 assertSuggestKeywords([], |
| 746 pseudoKeywords: ['show', 'hide'], relevance: DART_RELEVANCE_HIGH); |
| 746 } | 747 } |
| 747 | 748 |
| 748 test_import_as() { | 749 test_import_as() { |
| 749 addTestSource('import "foo" deferred ^;'); | 750 addTestSource('import "foo" deferred ^;'); |
| 750 expect(computeFast(), isTrue); | 751 expect(computeFast(), isTrue); |
| 751 assertSuggestKeywords([Keyword.AS], relevance: DART_RELEVANCE_HIGH); | 752 assertSuggestKeywords([Keyword.AS], relevance: DART_RELEVANCE_HIGH); |
| 752 } | 753 } |
| 753 | 754 |
| 754 test_import_as2() { | 755 test_import_as2() { |
| 755 addTestSource('import "foo" deferred a^;'); | 756 addTestSource('import "foo" deferred a^;'); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 771 | 772 |
| 772 test_import_deferred2() { | 773 test_import_deferred2() { |
| 773 addTestSource('import "foo" d^ as foo;'); | 774 addTestSource('import "foo" d^ as foo;'); |
| 774 expect(computeFast(), isTrue); | 775 expect(computeFast(), isTrue); |
| 775 assertSuggestKeywords([Keyword.DEFERRED], relevance: DART_RELEVANCE_HIGH); | 776 assertSuggestKeywords([Keyword.DEFERRED], relevance: DART_RELEVANCE_HIGH); |
| 776 } | 777 } |
| 777 | 778 |
| 778 test_import_deferred3() { | 779 test_import_deferred3() { |
| 779 addTestSource('import "foo" d^ show foo;'); | 780 addTestSource('import "foo" d^ show foo;'); |
| 780 expect(computeFast(), isTrue); | 781 expect(computeFast(), isTrue); |
| 781 assertSuggestKeywords([Keyword.AS, Keyword.DEFERRED], | 782 assertSuggestKeywords([Keyword.AS], |
| 782 relevance: DART_RELEVANCE_HIGH); | 783 pseudoKeywords: ['deferred as'], relevance: DART_RELEVANCE_HIGH); |
| 783 } | 784 } |
| 784 | 785 |
| 785 test_import_deferred4() { | 786 test_import_deferred4() { |
| 786 addTestSource('import "foo" d^ hide foo;'); | 787 addTestSource('import "foo" d^ hide foo;'); |
| 787 expect(computeFast(), isTrue); | 788 expect(computeFast(), isTrue); |
| 788 assertSuggestKeywords([Keyword.AS, Keyword.DEFERRED], | 789 assertSuggestKeywords([Keyword.AS], |
| 789 relevance: DART_RELEVANCE_HIGH); | 790 pseudoKeywords: ['deferred as'], relevance: DART_RELEVANCE_HIGH); |
| 790 } | 791 } |
| 791 | 792 |
| 792 test_import_deferred5() { | 793 test_import_deferred5() { |
| 793 addTestSource('import "foo" d^'); | 794 addTestSource('import "foo" d^'); |
| 794 expect(computeFast(), isTrue); | 795 expect(computeFast(), isTrue); |
| 795 assertSuggestKeywords([Keyword.AS, Keyword.DEFERRED], | 796 assertSuggestKeywords([Keyword.AS], |
| 797 pseudoKeywords: ['deferred as', 'show', 'hide'], |
| 796 relevance: DART_RELEVANCE_HIGH); | 798 relevance: DART_RELEVANCE_HIGH); |
| 797 } | 799 } |
| 798 | 800 |
| 799 test_import_deferred6() { | 801 test_import_deferred6() { |
| 800 addTestSource('import "foo" d^ import'); | 802 addTestSource('import "foo" d^ import'); |
| 801 expect(computeFast(), isTrue); | 803 expect(computeFast(), isTrue); |
| 802 assertSuggestKeywords([Keyword.AS, Keyword.DEFERRED], | 804 assertSuggestKeywords([Keyword.AS], |
| 803 relevance: DART_RELEVANCE_HIGH); | 805 pseudoKeywords: ['deferred as', 'show', 'hide'], relevance: DART_RELEVAN
CE_HIGH); |
| 804 } | 806 } |
| 805 | 807 |
| 806 test_import_deferred_as() { | 808 test_import_deferred_as() { |
| 807 addTestSource('import "foo" ^;'); | 809 addTestSource('import "foo" ^;'); |
| 808 expect(computeFast(), isTrue); | 810 expect(computeFast(), isTrue); |
| 809 assertSuggestKeywords([Keyword.AS, Keyword.DEFERRED], | 811 assertSuggestKeywords([Keyword.AS], |
| 810 relevance: DART_RELEVANCE_HIGH); | 812 pseudoKeywords: ['deferred as', 'show', 'hide'], relevance: DART_RELEVAN
CE_HIGH); |
| 811 } | 813 } |
| 812 | 814 |
| 813 test_import_deferred_as2() { | 815 test_import_deferred_as2() { |
| 814 addTestSource('import "foo" d^;'); | 816 addTestSource('import "foo" d^;'); |
| 815 expect(computeFast(), isTrue); | 817 expect(computeFast(), isTrue); |
| 816 assertSuggestKeywords([Keyword.AS, Keyword.DEFERRED], | 818 assertSuggestKeywords([Keyword.AS], |
| 817 relevance: DART_RELEVANCE_HIGH); | 819 pseudoKeywords: ['deferred as', 'show', 'hide'], relevance: DART_RELEVAN
CE_HIGH); |
| 818 } | 820 } |
| 819 | 821 |
| 820 test_import_deferred_as3() { | 822 test_import_deferred_as3() { |
| 821 addTestSource('import "foo" ^'); | 823 addTestSource('import "foo" ^'); |
| 822 expect(computeFast(), isTrue); | 824 expect(computeFast(), isTrue); |
| 823 assertSuggestKeywords([Keyword.AS, Keyword.DEFERRED], | 825 assertSuggestKeywords([Keyword.AS], |
| 824 relevance: DART_RELEVANCE_HIGH); | 826 pseudoKeywords: ['deferred as', 'show', 'hide'], relevance: DART_RELEVAN
CE_HIGH); |
| 825 } | 827 } |
| 826 | 828 |
| 827 test_import_deferred_as4() { | 829 test_import_deferred_as4() { |
| 828 addTestSource('import "foo" d^'); | 830 addTestSource('import "foo" d^'); |
| 829 expect(computeFast(), isTrue); | 831 expect(computeFast(), isTrue); |
| 830 assertSuggestKeywords([Keyword.AS, Keyword.DEFERRED], | 832 assertSuggestKeywords([Keyword.AS], |
| 831 relevance: DART_RELEVANCE_HIGH); | 833 pseudoKeywords: ['deferred as', 'show', 'hide'], relevance: DART_RELEVAN
CE_HIGH); |
| 832 } | 834 } |
| 833 | 835 |
| 834 test_import_deferred_not() { | 836 test_import_deferred_not() { |
| 835 addTestSource('import "foo" as foo ^;'); | 837 addTestSource('import "foo" as foo ^;'); |
| 836 expect(computeFast(), isTrue); | 838 expect(computeFast(), isTrue); |
| 837 assertSuggestKeywords([], relevance: DART_RELEVANCE_HIGH); | 839 assertSuggestKeywords([], |
| 840 pseudoKeywords: ['show', 'hide'], relevance: DART_RELEVANCE_HIGH); |
| 838 } | 841 } |
| 839 | 842 |
| 840 test_library() { | 843 test_library() { |
| 841 addTestSource('library foo;^'); | 844 addTestSource('library foo;^'); |
| 842 expect(computeFast(), isTrue); | 845 expect(computeFast(), isTrue); |
| 843 assertSuggestKeywords(DIRECTIVE_AND_DECLARATION_KEYWORDS, | 846 assertSuggestKeywords(DIRECTIVE_AND_DECLARATION_KEYWORDS, |
| 844 relevance: DART_RELEVANCE_HIGH); | 847 relevance: DART_RELEVANCE_HIGH); |
| 845 } | 848 } |
| 846 | 849 |
| 847 test_library_declaration() { | 850 test_library_declaration() { |
| (...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1176 (c) => msg.writeln(' $c, ${other.contains(c) ? '' : '<<<<<<<<<<<'}')); | 1179 (c) => msg.writeln(' $c, ${other.contains(c) ? '' : '<<<<<<<<<<<'}')); |
| 1177 } | 1180 } |
| 1178 | 1181 |
| 1179 bool _equalSets(Iterable<String> iter1, Iterable<String> iter2) { | 1182 bool _equalSets(Iterable<String> iter1, Iterable<String> iter2) { |
| 1180 if (iter1.length != iter2.length) return false; | 1183 if (iter1.length != iter2.length) return false; |
| 1181 if (iter1.any((c) => !iter2.contains(c))) return false; | 1184 if (iter1.any((c) => !iter2.contains(c))) return false; |
| 1182 if (iter2.any((c) => !iter1.contains(c))) return false; | 1185 if (iter2.any((c) => !iter1.contains(c))) return false; |
| 1183 return true; | 1186 return true; |
| 1184 } | 1187 } |
| 1185 } | 1188 } |
| OLD | NEW |