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

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

Issue 695773003: move import combinator suggestions into a separate computer (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: merge Created 6 years, 2 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
Index: pkg/analysis_server/test/services/completion/combinator_computer_test.dart
diff --git a/pkg/analysis_server/test/services/completion/combinator_computer_test.dart b/pkg/analysis_server/test/services/completion/combinator_computer_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..af4fc0f1f0e47659aa19aee40ad973af27bab480
--- /dev/null
+++ b/pkg/analysis_server/test/services/completion/combinator_computer_test.dart
@@ -0,0 +1,155 @@
+// 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/src/protocol.dart';
+import 'package:analysis_server/src/services/completion/combinator_computer.dart';
+import 'package:unittest/unittest.dart';
+
+import '../../reflective_tests.dart';
+import 'completion_test_util.dart';
+
+main() {
+ groupSep = ' | ';
+ runReflectiveTests(CombinatorComputerTest);
+}
+
+@ReflectiveTestCase()
+class CombinatorComputerTest extends AbstractCompletionTest {
+
+ @override
+ void setUp() {
+ super.setUp();
+ computer = new CombinatorComputer();
+ }
+
+ test_Block_inherited_local() {
+ // 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() {^}}''');
+ computeFast();
+ return computeFull(true).then((_) {
+ assertNoSuggestions();
+ });
+ }
+
+ test_Combinator_hide() {
+ // SimpleIdentifier HideCombinator ImportDirective
+ 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 {}''');
+ computeFast();
+ return computeFull(true).then((_) {
+ assertSuggestClass(
+ 'A',
+ CompletionRelevance.DEFAULT,
+ CompletionSuggestionKind.IDENTIFIER);
+ assertSuggestClass(
+ 'B',
+ CompletionRelevance.DEFAULT,
+ CompletionSuggestionKind.IDENTIFIER);
+ assertSuggestClass(
+ 'PB',
+ CompletionRelevance.DEFAULT,
+ CompletionSuggestionKind.IDENTIFIER);
+ assertSuggestTopLevelVar(
+ 'T1',
+ null,
+ CompletionRelevance.DEFAULT,
+ CompletionSuggestionKind.IDENTIFIER);
+ assertSuggestFunction(
+ 'F1',
+ 'PB',
+ false,
+ CompletionRelevance.DEFAULT,
+ CompletionSuggestionKind.IDENTIFIER);
+ assertNotSuggested('C');
+ assertNotSuggested('D');
+ assertNotSuggested('X');
+ assertNotSuggested('Object');
+ });
+ }
+
+ test_Combinator_show() {
+ // SimpleIdentifier HideCombinator ImportDirective
+ 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 {}''');
+ computeFast();
+ return computeFull(true).then((_) {
+ assertSuggestClass(
+ 'A',
+ CompletionRelevance.DEFAULT,
+ CompletionSuggestionKind.IDENTIFIER);
+ assertSuggestClass(
+ 'B',
+ CompletionRelevance.DEFAULT,
+ CompletionSuggestionKind.IDENTIFIER);
+ assertSuggestClass(
+ 'PB',
+ CompletionRelevance.DEFAULT,
+ CompletionSuggestionKind.IDENTIFIER);
+ assertSuggestTopLevelVar(
+ 'T1',
+ null,
+ CompletionRelevance.DEFAULT,
+ CompletionSuggestionKind.IDENTIFIER);
+ assertSuggestFunction(
+ 'F1',
+ 'PB',
+ false,
+ CompletionRelevance.DEFAULT,
+ CompletionSuggestionKind.IDENTIFIER);
+ assertSuggestClass(
+ 'Clz',
+ CompletionRelevance.DEFAULT,
+ CompletionSuggestionKind.IDENTIFIER);
+ assertSuggestFunctionTypeAlias(
+ 'F2',
+ null,
+ false,
+ CompletionRelevance.DEFAULT,
+ CompletionSuggestionKind.IDENTIFIER);
+ assertNotSuggested('C');
+ assertNotSuggested('D');
+ assertNotSuggested('X');
+ assertNotSuggested('Object');
+ });
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698