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

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

Issue 1503463002: move combinator contributor to new task model (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: remove old code Created 5 years 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
Index: pkg/analysis_server/test/services/completion/dart/combinator_contributor_test.dart
diff --git a/pkg/analysis_server/test/services/completion/dart/combinator_contributor_test.dart b/pkg/analysis_server/test/services/completion/dart/combinator_contributor_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..50999b069ddb0fa62c040a6dde475ea33a3aee16
--- /dev/null
+++ b/pkg/analysis_server/test/services/completion/dart/combinator_contributor_test.dart
@@ -0,0 +1,144 @@
+// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+library test.services.completion.dart.combinator;
+
+import 'package:analysis_server/plugin/protocol/protocol.dart';
+import 'package:analysis_server/src/provisional/completion/dart/completion_dart.dart';
+import 'package:analysis_server/src/services/completion/dart/combinator_contributor.dart';
+import 'package:test_reflective_loader/test_reflective_loader.dart';
+
+import '../../../utils.dart';
+import 'completion_contributor_util.dart';
+import 'package:analyzer/src/generated/source.dart';
+
+main() {
+ initializeTestEnvironment();
+ defineReflectiveTests(CombinatorContributorTest);
+}
+
+@reflectiveTest
+class CombinatorContributorTest extends DartCompletionContributorTest {
+ @override
+ DartCompletionContributor createContributor() {
+ return new CombinatorContributor();
+ }
+
+ test_Block_inherited_local() async {
+ // Block BlockFunctionBody MethodDeclaration ClassDeclaration
+ addTestSource('''
+ class F { var f1; f2() { } }
+ class E extends F { var e1; e2() { } }
+ class I { int i1; i2() { } }
+ class M { var m1; int m2() { } }
+ class A extends E implements I with M {a() {^}}''');
+ await computeSuggestions();
+ assertNoSuggestions();
+ }
+
+ test_Combinator_hide() async {
+ // SimpleIdentifier HideCombinator ImportDirective
+ Source importedLibSource = addSource(
+ '/testAB.dart',
+ '''
+ library libAB;
+ part '/partAB.dart';
+ class A { }
+ class B { }''');
+ addSource(
+ '/partAB.dart',
+ '''
+ part of libAB;
+ var T1;
+ PB F1() => new PB();
+ class PB { }''');
+ addSource(
+ '/testCD.dart',
+ '''
+ class C { }
+ class D { }''');
+ addTestSource('''
+ import "/testAB.dart" hide ^;
+ import "/testCD.dart";
+ class X {}''');
+
+ // Assume that imported libraries have been resolved
+ context.resolveCompilationUnit2(importedLibSource, importedLibSource);
+
+ await computeSuggestions();
+ assertSuggestClass('A',
+ relevance: DART_RELEVANCE_DEFAULT,
+ kind: CompletionSuggestionKind.IDENTIFIER);
+ assertSuggestClass('B',
+ relevance: DART_RELEVANCE_DEFAULT,
+ kind: CompletionSuggestionKind.IDENTIFIER);
+ assertSuggestClass('PB',
+ relevance: DART_RELEVANCE_DEFAULT,
+ kind: CompletionSuggestionKind.IDENTIFIER);
+ assertSuggestTopLevelVar('T1', null, DART_RELEVANCE_DEFAULT,
+ CompletionSuggestionKind.IDENTIFIER);
+ assertSuggestFunction('F1', 'PB',
+ kind: CompletionSuggestionKind.IDENTIFIER);
+ assertNotSuggested('C');
+ assertNotSuggested('D');
+ assertNotSuggested('X');
+ assertNotSuggested('Object');
+ }
+
+ test_Combinator_show() async {
+ // SimpleIdentifier HideCombinator ImportDirective
+ Source importedLibSource = addSource(
+ '/testAB.dart',
+ '''
+ library libAB;
+ part '/partAB.dart';
+ class A { }
+ class B { }''');
+ addSource(
+ '/partAB.dart',
+ '''
+ part of libAB;
+ var T1;
+ PB F1() => new PB();
+ typedef PB2 F2(int blat);
+ class Clz = Object with Object;
+ class PB { }''');
+ addSource(
+ '/testCD.dart',
+ '''
+ class C { }
+ class D { }''');
+ addTestSource('''
+ import "/testAB.dart" show ^;
+ import "/testCD.dart";
+ class X {}''');
+
+ // Assume that imported libraries have been resolved
+ context.resolveCompilationUnit2(importedLibSource, importedLibSource);
+
+ await computeSuggestions();
+ assertSuggestClass('A',
+ relevance: DART_RELEVANCE_DEFAULT,
+ kind: CompletionSuggestionKind.IDENTIFIER);
+ assertSuggestClass('B',
+ relevance: DART_RELEVANCE_DEFAULT,
+ kind: CompletionSuggestionKind.IDENTIFIER);
+ assertSuggestClass('PB',
+ relevance: DART_RELEVANCE_DEFAULT,
+ kind: CompletionSuggestionKind.IDENTIFIER);
+ assertSuggestTopLevelVar('T1', null, DART_RELEVANCE_DEFAULT,
+ CompletionSuggestionKind.IDENTIFIER);
+ assertSuggestFunction('F1', 'PB',
+ kind: CompletionSuggestionKind.IDENTIFIER);
+ assertSuggestClass('Clz',
+ relevance: DART_RELEVANCE_DEFAULT,
+ kind: CompletionSuggestionKind.IDENTIFIER);
+ assertSuggestFunctionTypeAlias('F2', null, false, DART_RELEVANCE_DEFAULT,
+ CompletionSuggestionKind.IDENTIFIER);
+ assertNotSuggested('C');
+ assertNotSuggested('D');
+ assertNotSuggested('X');
+ assertNotSuggested('Object');
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698