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

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

Issue 483803002: improve keyword suggestions (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: merge Created 6 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « pkg/analysis_server/lib/src/services/completion/keyword_computer.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/services/completion/completion_suggestion.da rt'; 7 import 'package:analysis_server/src/services/completion/completion_suggestion.da rt';
8 import 'package:analysis_server/src/services/completion/keyword_computer.dart'; 8 import 'package:analysis_server/src/services/completion/keyword_computer.dart';
9 import 'package:analysis_testing/reflective_tests.dart'; 9 import 'package:analysis_testing/reflective_tests.dart';
10 import 'package:analyzer/src/generated/scanner.dart'; 10 import 'package:analyzer/src/generated/scanner.dart';
(...skipping 18 matching lines...) Expand all
29 } 29 }
30 }); 30 });
31 } 31 }
32 32
33 @override 33 @override
34 void setUp() { 34 void setUp() {
35 super.setUp(); 35 super.setUp();
36 computer = new KeywordComputer(); 36 computer = new KeywordComputer();
37 } 37 }
38 38
39 test_class_extends() { 39 test_after_class() {
40 addTestSource('class A {} ^');
41 expect(computeFast(), isTrue);
42 assertSuggestKeywords(
43 ['abstract', 'class', 'const', 'final', 'typedef', 'var']);
44 }
45
46 test_before_import() {
47 addTestSource('^ import foo;');
48 expect(computeFast(), isTrue);
49 assertSuggestKeywords(['export', 'import', 'library', 'part']);
50 }
51
52 test_class() {
40 addTestSource('class A ^'); 53 addTestSource('class A ^');
41 expect(computeFast(), isTrue); 54 expect(computeFast(), isTrue);
42 assertSuggestKeywords(['extends', 'implements', 'with']); 55 assertSuggestKeywords(['extends', 'implements']);
56 }
57
58 test_class_extends() {
59 addTestSource('class A extends foo ^');
60 expect(computeFast(), isTrue);
61 assertSuggestKeywords(['implements', 'with']);
43 } 62 }
44 63
45 test_class_extends_name() { 64 test_class_extends_name() {
46 addTestSource('class A extends ^'); 65 addTestSource('class A extends ^');
47 expect(computeFast(), isTrue); 66 expect(computeFast(), isTrue);
48 assertSuggestKeywords([]); 67 assertSuggestKeywords([]);
49 } 68 }
50 69
70 test_class_implements() {
71 addTestSource('class A ^ implements foo');
72 expect(computeFast(), isTrue);
73 assertSuggestKeywords(['extends']);
74 }
75
76 test_class_implements_name() {
77 addTestSource('class A implements ^');
78 expect(computeFast(), isTrue);
79 assertSuggestKeywords([]);
80 }
81
51 test_class_name() { 82 test_class_name() {
52 addTestSource('class ^'); 83 addTestSource('class ^');
53 expect(computeFast(), isTrue); 84 expect(computeFast(), isTrue);
54 assertSuggestKeywords([]); 85 assertSuggestKeywords([]);
55 } 86 }
56 87
88 test_class_with_name() {
89 addTestSource('class A extends foo with ^');
90 expect(computeFast(), isTrue);
91 assertSuggestKeywords([]);
92 }
93
57 test_empty() { 94 test_empty() {
58 addTestSource('^'); 95 addTestSource('^');
59 expect(computeFast(), isTrue); 96 expect(computeFast(), isTrue);
60 assertSuggestKeywords( 97 assertSuggestKeywords(
61 [ 98 [
62 'abstract', 99 'abstract',
63 'class', 100 'class',
64 'const', 101 'const',
65 'export', 102 'export',
66 'final', 103 'final',
67 'import', 104 'import',
68 'library', 105 'library',
69 'part', 106 'part',
70 'typedef', 107 'typedef',
71 'var']); 108 'var']);
72 } 109 }
110
111 test_library() {
112 addTestSource('library foo;^');
113 expect(computeFast(), isTrue);
114 assertSuggestKeywords(
115 [
116 'abstract',
117 'class',
118 'const',
119 'export',
120 'final',
121 'import',
122 'part',
123 'typedef',
124 'var']);
125 }
126
127 test_library_name() {
128 addTestSource('library ^');
129 expect(computeFast(), isTrue);
130 assertSuggestKeywords([]);
131 }
132
133 test_part_of() {
134 addTestSource('part of foo;^');
135 expect(computeFast(), isTrue);
136 assertSuggestKeywords(
137 [
138 'abstract',
139 'class',
140 'const',
141 'export',
142 'final',
143 'import',
144 'part',
145 'typedef',
146 'var']);
147 }
73 } 148 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/lib/src/services/completion/keyword_computer.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698