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

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

Issue 1889873003: Code completion tests: 2 additional tests for the is and as expressions. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 8 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 | « no previous file | 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/dart/local_reference_contributor_test.dart
diff --git a/pkg/analysis_server/test/services/completion/dart/local_reference_contributor_test.dart b/pkg/analysis_server/test/services/completion/dart/local_reference_contributor_test.dart
index 50f8ec3612f92fd3c123a890afac67734d7619bc..71bb3b2e09a9a580b7c92b7c378dccc65de92836 100644
--- a/pkg/analysis_server/test/services/completion/dart/local_reference_contributor_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/local_reference_contributor_test.dart
@@ -378,6 +378,18 @@ f(A a){ (a as ^) }''');
assertNotSuggested('Object');
}
+ test_AsExpression_type_filter_undefined_type() async {
+ // SimpleIdentifier TypeName AsExpression
+ addTestSource('''
+class A {}
+f(U u){ (u as ^) }''');
+ await computeSuggestions();
+
+ expect(replacementOffset, completionOffset);
+ expect(replacementLength, 0);
+ assertSuggestClass('A');
+ }
+
test_AssignmentExpression_name() async {
// SimpleIdentifier VariableDeclaration VariableDeclarationList
// VariableDeclarationStatement Block
@@ -2803,21 +2815,6 @@ main(){var a; if (a is ^)}''');
assertNotSuggested('Object');
}
- test_IsExpression_type_partial() async {
- // SimpleIdentifier TypeName IsExpression IfStatement
- addTestSource('''
-class A {int x; int y() => 0;}
-main(){var a; if (a is Obj^)}''');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset - 3);
- expect(replacementLength, 3);
- assertNotSuggested('a');
- assertNotSuggested('main');
- assertSuggestClass('A');
- assertNotSuggested('Object');
- }
-
test_IsExpression_type_filter_extends() async {
// SimpleIdentifier TypeName IsExpression IfStatement
addTestSource('''
@@ -2850,6 +2847,33 @@ f(A a){ if (a is ^) {}}''');
assertNotSuggested('Object');
}
+ test_IsExpression_type_filter_undefined_type() async {
+ // SimpleIdentifier TypeName AsExpression
+ addTestSource('''
+class A {}
+f(U u){ (u as ^) }''');
+ await computeSuggestions();
+
+ expect(replacementOffset, completionOffset);
+ expect(replacementLength, 0);
+ assertSuggestClass('A');
+ }
+
+ test_IsExpression_type_partial() async {
+ // SimpleIdentifier TypeName IsExpression IfStatement
+ addTestSource('''
+class A {int x; int y() => 0;}
+main(){var a; if (a is Obj^)}''');
+ await computeSuggestions();
+
+ expect(replacementOffset, completionOffset - 3);
+ expect(replacementLength, 3);
+ assertNotSuggested('a');
+ assertNotSuggested('main');
+ assertSuggestClass('A');
+ assertNotSuggested('Object');
+ }
+
test_keyword() async {
addSource(
'/testB.dart',
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698