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

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

Issue 1875283002: Additional code completion tests for the as expression in imported_reference_contributor_test.dart (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/imported_reference_contributor_test.dart
diff --git a/pkg/analysis_server/test/services/completion/dart/imported_reference_contributor_test.dart b/pkg/analysis_server/test/services/completion/dart/imported_reference_contributor_test.dart
index c5020b49027c1c77daed73deda6ada66ff47e2c2..6b63ce00d054f5bedfa592fd0f7d2f36e4b753e9 100644
--- a/pkg/analysis_server/test/services/completion/dart/imported_reference_contributor_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/imported_reference_contributor_test.dart
@@ -332,6 +332,54 @@ class ImportedReferenceContributorTest extends DartCompletionContributorTest {
assertNotSuggested('==');
}
+ test_AsExpression_type_subtype_extends_filter() async {
+ // SimpleIdentifier TypeName AsExpression IfStatement
+ addSource(
+ '/testB.dart',
+ '''
+ foo() { }
+ class A {} class B extends A {} class C extends B {}
+ class X {X.c(); X._d(); z() {}}''');
+ addTestSource('''
+ import "/testB.dart";
+ main(){A a; if (a as ^)}''');
+
+ await computeSuggestions();
+ expect(replacementOffset, completionOffset);
+ expect(replacementLength, 0);
+ assertSuggestClass('B');
+ assertSuggestClass('C');
+ assertNotSuggested('A');
+ assertNotSuggested('X');
+ assertNotSuggested('Object');
+ assertNotSuggested('a');
+ assertNotSuggested('main');
+ }
+
+ test_AsExpression_type_subtype_implements_filter() async {
+ // SimpleIdentifier TypeName AsExpression IfStatement
+ addSource(
+ '/testB.dart',
+ '''
+ foo() { }
+ class A {} class B implements A {} class C implements B {}
+ class X {X.c(); X._d(); z() {}}''');
+ addTestSource('''
+ import "/testB.dart";
+ main(){A a; if (a as ^)}''');
+
+ await computeSuggestions();
+ expect(replacementOffset, completionOffset);
+ expect(replacementLength, 0);
+ assertSuggestClass('B');
+ assertSuggestClass('C');
+ assertNotSuggested('A');
+ assertNotSuggested('X');
+ assertNotSuggested('Object');
+ assertNotSuggested('a');
+ assertNotSuggested('main');
+ }
+
test_AssignmentExpression_name() async {
// SimpleIdentifier VariableDeclaration VariableDeclarationList
// VariableDeclarationStatement Block
« 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