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

Unified Diff: pkg/analysis_server/test/services/completion/prefixed_element_contributor_test.dart

Issue 1157113004: add enum suggestions (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: merge Created 5 years, 7 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/test/services/completion/local_reference_contributor_test.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/prefixed_element_contributor_test.dart
diff --git a/pkg/analysis_server/test/services/completion/prefixed_element_contributor_test.dart b/pkg/analysis_server/test/services/completion/prefixed_element_contributor_test.dart
index 8015d8ffc3379cc2bda0e8162c28e42a38b47e57..7e77a87bb267b74284aad467b796ea74d2312897 100644
--- a/pkg/analysis_server/test/services/completion/prefixed_element_contributor_test.dart
+++ b/pkg/analysis_server/test/services/completion/prefixed_element_contributor_test.dart
@@ -60,6 +60,19 @@ void f(Derived d) {
});
}
+ fail_enumConst_deprecated() {
+ addTestSource('@deprecated enum E { one, two } main() {E.^}');
+ return computeFull((bool result) {
+ assertNotSuggested('E');
+ // TODO(danrubel) Investigate why enum suggestion is not marked
+ // as deprecated if enum ast element is deprecated
+ assertSuggestEnumConst('one', isDeprecated: true);
+ assertSuggestEnumConst('two', isDeprecated: true);
+ assertNotSuggested('index');
+ assertSuggestField('values', 'List<E>', isDeprecated: true);
+ });
+ }
+
fail_test_PrefixedIdentifier_trailingStmt_const_untyped() {
// SimpleIdentifier PrefixedIdentifier ExpressionStatement
addTestSource('const g = "hello"; f() {g.^ int y = 0;}');
@@ -74,6 +87,72 @@ void f(Derived d) {
contributor = new PrefixedElementContributor();
}
+ test_enumConst() {
+ addTestSource('enum E { one, two } main() {E.^}');
+ return computeFull((bool result) {
+ assertNotSuggested('E');
+ assertSuggestEnumConst('one');
+ assertSuggestEnumConst('two');
+ assertNotSuggested('index');
+ assertSuggestField('values', 'List<E>');
+ });
+ }
+
+ test_enumConst2() {
+ addTestSource('enum E { one, two } main() {E.o^}');
+ return computeFull((bool result) {
+ assertNotSuggested('E');
+ assertSuggestEnumConst('one');
+ assertSuggestEnumConst('two');
+ assertNotSuggested('index');
+ assertSuggestField('values', 'List<E>');
+ });
+ }
+
+ test_enumConst3() {
+ addTestSource('enum E { one, two } main() {E.^ int g;}');
+ return computeFull((bool result) {
+ assertNotSuggested('E');
+ assertSuggestEnumConst('one');
+ assertSuggestEnumConst('two');
+ assertNotSuggested('index');
+ assertSuggestField('values', 'List<E>');
+ });
+ }
+
+ test_enumConst_index() {
+ addTestSource('enum E { one, two } main() {E.one.^}');
+ return computeFull((bool result) {
+ assertNotSuggested('E');
+ assertNotSuggested('one');
+ assertNotSuggested('two');
+ assertSuggestField('index', 'int');
+ assertNotSuggested('values');
+ });
+ }
+
+ test_enumConst_index2() {
+ addTestSource('enum E { one, two } main() {E.one.i^}');
+ return computeFull((bool result) {
+ assertNotSuggested('E');
+ assertNotSuggested('one');
+ assertNotSuggested('two');
+ assertSuggestField('index', 'int');
+ assertNotSuggested('values');
+ });
+ }
+
+ test_enumConst_index3() {
+ addTestSource('enum E { one, two } main() {E.one.^ int g;}');
+ return computeFull((bool result) {
+ assertNotSuggested('E');
+ assertNotSuggested('one');
+ assertNotSuggested('two');
+ assertSuggestField('index', 'int');
+ assertNotSuggested('values');
+ });
+ }
+
test_generic_field() {
addTestSource('''
class C<T> {
« no previous file with comments | « pkg/analysis_server/test/services/completion/local_reference_contributor_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698