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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analysis_server/lib/src/services/completion/keyword_computer.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/test/services/completion/keyword_computer_test.dart
diff --git a/pkg/analysis_server/test/services/completion/keyword_computer_test.dart b/pkg/analysis_server/test/services/completion/keyword_computer_test.dart
index 88527fd01774f2065e375cdcddf241038bf5644e..89901541a02c8c82ed5ba01f7e2302118aac6989 100644
--- a/pkg/analysis_server/test/services/completion/keyword_computer_test.dart
+++ b/pkg/analysis_server/test/services/completion/keyword_computer_test.dart
@@ -36,10 +36,29 @@ class KeywordComputerTest extends AbstractCompletionTest {
computer = new KeywordComputer();
}
- test_class_extends() {
+ test_after_class() {
+ addTestSource('class A {} ^');
+ expect(computeFast(), isTrue);
+ assertSuggestKeywords(
+ ['abstract', 'class', 'const', 'final', 'typedef', 'var']);
+ }
+
+ test_before_import() {
+ addTestSource('^ import foo;');
+ expect(computeFast(), isTrue);
+ assertSuggestKeywords(['export', 'import', 'library', 'part']);
+ }
+
+ test_class() {
addTestSource('class A ^');
expect(computeFast(), isTrue);
- assertSuggestKeywords(['extends', 'implements', 'with']);
+ assertSuggestKeywords(['extends', 'implements']);
+ }
+
+ test_class_extends() {
+ addTestSource('class A extends foo ^');
+ expect(computeFast(), isTrue);
+ assertSuggestKeywords(['implements', 'with']);
}
test_class_extends_name() {
@@ -48,12 +67,30 @@ class KeywordComputerTest extends AbstractCompletionTest {
assertSuggestKeywords([]);
}
+ test_class_implements() {
+ addTestSource('class A ^ implements foo');
+ expect(computeFast(), isTrue);
+ assertSuggestKeywords(['extends']);
+ }
+
+ test_class_implements_name() {
+ addTestSource('class A implements ^');
+ expect(computeFast(), isTrue);
+ assertSuggestKeywords([]);
+ }
+
test_class_name() {
addTestSource('class ^');
expect(computeFast(), isTrue);
assertSuggestKeywords([]);
}
+ test_class_with_name() {
+ addTestSource('class A extends foo with ^');
+ expect(computeFast(), isTrue);
+ assertSuggestKeywords([]);
+ }
+
test_empty() {
addTestSource('^');
expect(computeFast(), isTrue);
@@ -70,4 +107,42 @@ class KeywordComputerTest extends AbstractCompletionTest {
'typedef',
'var']);
}
+
+ test_library() {
+ addTestSource('library foo;^');
+ expect(computeFast(), isTrue);
+ assertSuggestKeywords(
+ [
+ 'abstract',
+ 'class',
+ 'const',
+ 'export',
+ 'final',
+ 'import',
+ 'part',
+ 'typedef',
+ 'var']);
+ }
+
+ test_library_name() {
+ addTestSource('library ^');
+ expect(computeFast(), isTrue);
+ assertSuggestKeywords([]);
+ }
+
+ test_part_of() {
+ addTestSource('part of foo;^');
+ expect(computeFast(), isTrue);
+ assertSuggestKeywords(
+ [
+ 'abstract',
+ 'class',
+ 'const',
+ 'export',
+ 'final',
+ 'import',
+ 'part',
+ 'typedef',
+ 'var']);
+ }
}
« 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