Skip to content

Commit

Permalink
Additional code completion tests for the as expression in imported_re…
Browse files Browse the repository at this point in the history
…ference_contributor_test.dart

R=danrubel@google.com

Review URL: https://codereview.chromium.org/1875283002 .
  • Loading branch information
jwren committed Apr 12, 2016
1 parent 7146915 commit 7b8d0b7
Showing 1 changed file with 48 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 7b8d0b7

Please sign in to comment.