| 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 784 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 795 expect(computeFast(), isTrue); | 795 expect(computeFast(), isTrue); |
| 796 assertSuggestKeywords([Keyword.AS], | 796 assertSuggestKeywords([Keyword.AS], |
| 797 pseudoKeywords: ['deferred as', 'show', 'hide'], | 797 pseudoKeywords: ['deferred as', 'show', 'hide'], |
| 798 relevance: DART_RELEVANCE_HIGH); | 798 relevance: DART_RELEVANCE_HIGH); |
| 799 } | 799 } |
| 800 | 800 |
| 801 test_import_deferred6() { | 801 test_import_deferred6() { |
| 802 addTestSource('import "foo" d^ import'); | 802 addTestSource('import "foo" d^ import'); |
| 803 expect(computeFast(), isTrue); | 803 expect(computeFast(), isTrue); |
| 804 assertSuggestKeywords([Keyword.AS], | 804 assertSuggestKeywords([Keyword.AS], |
| 805 pseudoKeywords: ['deferred as', 'show', 'hide'], relevance: DART_RELEVAN
CE_HIGH); | 805 pseudoKeywords: ['deferred as', 'show', 'hide'], |
| 806 relevance: DART_RELEVANCE_HIGH); |
| 806 } | 807 } |
| 807 | 808 |
| 808 test_import_deferred_as() { | 809 test_import_deferred_as() { |
| 809 addTestSource('import "foo" ^;'); | 810 addTestSource('import "foo" ^;'); |
| 810 expect(computeFast(), isTrue); | 811 expect(computeFast(), isTrue); |
| 811 assertSuggestKeywords([Keyword.AS], | 812 assertSuggestKeywords([Keyword.AS], |
| 812 pseudoKeywords: ['deferred as', 'show', 'hide'], relevance: DART_RELEVAN
CE_HIGH); | 813 pseudoKeywords: ['deferred as', 'show', 'hide'], |
| 814 relevance: DART_RELEVANCE_HIGH); |
| 813 } | 815 } |
| 814 | 816 |
| 815 test_import_deferred_as2() { | 817 test_import_deferred_as2() { |
| 816 addTestSource('import "foo" d^;'); | 818 addTestSource('import "foo" d^;'); |
| 817 expect(computeFast(), isTrue); | 819 expect(computeFast(), isTrue); |
| 818 assertSuggestKeywords([Keyword.AS], | 820 assertSuggestKeywords([Keyword.AS], |
| 819 pseudoKeywords: ['deferred as', 'show', 'hide'], relevance: DART_RELEVAN
CE_HIGH); | 821 pseudoKeywords: ['deferred as', 'show', 'hide'], |
| 822 relevance: DART_RELEVANCE_HIGH); |
| 820 } | 823 } |
| 821 | 824 |
| 822 test_import_deferred_as3() { | 825 test_import_deferred_as3() { |
| 823 addTestSource('import "foo" ^'); | 826 addTestSource('import "foo" ^'); |
| 824 expect(computeFast(), isTrue); | 827 expect(computeFast(), isTrue); |
| 825 assertSuggestKeywords([Keyword.AS], | 828 assertSuggestKeywords([Keyword.AS], |
| 826 pseudoKeywords: ['deferred as', 'show', 'hide'], relevance: DART_RELEVAN
CE_HIGH); | 829 pseudoKeywords: ['deferred as', 'show', 'hide'], |
| 830 relevance: DART_RELEVANCE_HIGH); |
| 827 } | 831 } |
| 828 | 832 |
| 829 test_import_deferred_as4() { | 833 test_import_deferred_as4() { |
| 830 addTestSource('import "foo" d^'); | 834 addTestSource('import "foo" d^'); |
| 831 expect(computeFast(), isTrue); | 835 expect(computeFast(), isTrue); |
| 832 assertSuggestKeywords([Keyword.AS], | 836 assertSuggestKeywords([Keyword.AS], |
| 833 pseudoKeywords: ['deferred as', 'show', 'hide'], relevance: DART_RELEVAN
CE_HIGH); | 837 pseudoKeywords: ['deferred as', 'show', 'hide'], |
| 838 relevance: DART_RELEVANCE_HIGH); |
| 834 } | 839 } |
| 835 | 840 |
| 836 test_import_deferred_not() { | 841 test_import_deferred_not() { |
| 837 addTestSource('import "foo" as foo ^;'); | 842 addTestSource('import "foo" as foo ^;'); |
| 838 expect(computeFast(), isTrue); | 843 expect(computeFast(), isTrue); |
| 839 assertSuggestKeywords([], | 844 assertSuggestKeywords([], |
| 840 pseudoKeywords: ['show', 'hide'], relevance: DART_RELEVANCE_HIGH); | 845 pseudoKeywords: ['show', 'hide'], relevance: DART_RELEVANCE_HIGH); |
| 841 } | 846 } |
| 842 | 847 |
| 848 test_import_incomplete() { |
| 849 addTestSource('import "^"'); |
| 850 expect(computeFast(), isTrue); |
| 851 assertNoSuggestions(); |
| 852 assertSuggestKeywords([]); |
| 853 } |
| 854 |
| 843 test_library() { | 855 test_library() { |
| 844 addTestSource('library foo;^'); | 856 addTestSource('library foo;^'); |
| 845 expect(computeFast(), isTrue); | 857 expect(computeFast(), isTrue); |
| 846 assertSuggestKeywords(DIRECTIVE_AND_DECLARATION_KEYWORDS, | 858 assertSuggestKeywords(DIRECTIVE_AND_DECLARATION_KEYWORDS, |
| 847 relevance: DART_RELEVANCE_HIGH); | 859 relevance: DART_RELEVANCE_HIGH); |
| 848 } | 860 } |
| 849 | 861 |
| 850 test_library_declaration() { | 862 test_library_declaration() { |
| 851 addTestSource('library ^'); | 863 addTestSource('library ^'); |
| 852 expect(computeFast(), isTrue); | 864 expect(computeFast(), isTrue); |
| (...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1179 (c) => msg.writeln(' $c, ${other.contains(c) ? '' : '<<<<<<<<<<<'}')); | 1191 (c) => msg.writeln(' $c, ${other.contains(c) ? '' : '<<<<<<<<<<<'}')); |
| 1180 } | 1192 } |
| 1181 | 1193 |
| 1182 bool _equalSets(Iterable<String> iter1, Iterable<String> iter2) { | 1194 bool _equalSets(Iterable<String> iter1, Iterable<String> iter2) { |
| 1183 if (iter1.length != iter2.length) return false; | 1195 if (iter1.length != iter2.length) return false; |
| 1184 if (iter1.any((c) => !iter2.contains(c))) return false; | 1196 if (iter1.any((c) => !iter2.contains(c))) return false; |
| 1185 if (iter2.any((c) => !iter1.contains(c))) return false; | 1197 if (iter2.any((c) => !iter1.contains(c))) return false; |
| 1186 return true; | 1198 return true; |
| 1187 } | 1199 } |
| 1188 } | 1200 } |
| OLD | NEW |