| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | |
| 2 // for details. All rights reserved. Use of this source code is governed by a | |
| 3 // BSD-style license that can be found in the LICENSE file. | |
| 4 | |
| 5 library test.services.completion.dart.combinator; | |
| 6 | |
| 7 import 'package:analysis_server/src/protocol.dart'; | |
| 8 import 'package:analysis_server/src/services/completion/combinator_computer.dart
'; | |
| 9 import 'package:analysis_server/src/services/completion/dart_completion_manager.
dart'; | |
| 10 import 'package:unittest/unittest.dart'; | |
| 11 | |
| 12 import '../../reflective_tests.dart'; | |
| 13 import 'completion_test_util.dart'; | |
| 14 | |
| 15 main() { | |
| 16 groupSep = ' | '; | |
| 17 runReflectiveTests(CombinatorContributorTest); | |
| 18 } | |
| 19 | |
| 20 @reflectiveTest | |
| 21 class CombinatorContributorTest extends AbstractCompletionTest { | |
| 22 @override | |
| 23 void setUpContributor() { | |
| 24 contributor = new CombinatorContributor(); | |
| 25 } | |
| 26 | |
| 27 test_Block_inherited_local() { | |
| 28 // Block BlockFunctionBody MethodDeclaration ClassDeclaration | |
| 29 addTestSource(''' | |
| 30 class F { var f1; f2() { } } | |
| 31 class E extends F { var e1; e2() { } } | |
| 32 class I { int i1; i2() { } } | |
| 33 class M { var m1; int m2() { } } | |
| 34 class A extends E implements I with M {a() {^}}'''); | |
| 35 computeFast(); | |
| 36 return computeFull((bool result) { | |
| 37 assertNoSuggestions(); | |
| 38 }); | |
| 39 } | |
| 40 | |
| 41 test_Combinator_hide() { | |
| 42 // SimpleIdentifier HideCombinator ImportDirective | |
| 43 addSource('/testAB.dart', ''' | |
| 44 library libAB; | |
| 45 part '/partAB.dart'; | |
| 46 class A { } | |
| 47 class B { }'''); | |
| 48 addSource('/partAB.dart', ''' | |
| 49 part of libAB; | |
| 50 var T1; | |
| 51 PB F1() => new PB(); | |
| 52 class PB { }'''); | |
| 53 addSource('/testCD.dart', ''' | |
| 54 class C { } | |
| 55 class D { }'''); | |
| 56 addTestSource(''' | |
| 57 import "/testAB.dart" hide ^; | |
| 58 import "/testCD.dart"; | |
| 59 class X {}'''); | |
| 60 computeFast(); | |
| 61 return computeFull((bool result) { | |
| 62 assertSuggestClass('A', | |
| 63 relevance: DART_RELEVANCE_DEFAULT, | |
| 64 kind: CompletionSuggestionKind.IDENTIFIER); | |
| 65 assertSuggestClass('B', | |
| 66 relevance: DART_RELEVANCE_DEFAULT, | |
| 67 kind: CompletionSuggestionKind.IDENTIFIER); | |
| 68 assertSuggestClass('PB', | |
| 69 relevance: DART_RELEVANCE_DEFAULT, | |
| 70 kind: CompletionSuggestionKind.IDENTIFIER); | |
| 71 assertSuggestTopLevelVar('T1', null, | |
| 72 DART_RELEVANCE_DEFAULT, CompletionSuggestionKind.IDENTIFIER); | |
| 73 assertSuggestFunction('F1', 'PB', | |
| 74 kind: CompletionSuggestionKind.IDENTIFIER); | |
| 75 assertNotSuggested('C'); | |
| 76 assertNotSuggested('D'); | |
| 77 assertNotSuggested('X'); | |
| 78 assertNotSuggested('Object'); | |
| 79 }); | |
| 80 } | |
| 81 | |
| 82 test_Combinator_show() { | |
| 83 // SimpleIdentifier HideCombinator ImportDirective | |
| 84 addSource('/testAB.dart', ''' | |
| 85 library libAB; | |
| 86 part '/partAB.dart'; | |
| 87 class A { } | |
| 88 class B { }'''); | |
| 89 addSource('/partAB.dart', ''' | |
| 90 part of libAB; | |
| 91 var T1; | |
| 92 PB F1() => new PB(); | |
| 93 typedef PB2 F2(int blat); | |
| 94 class Clz = Object with Object; | |
| 95 class PB { }'''); | |
| 96 addSource('/testCD.dart', ''' | |
| 97 class C { } | |
| 98 class D { }'''); | |
| 99 addTestSource(''' | |
| 100 import "/testAB.dart" show ^; | |
| 101 import "/testCD.dart"; | |
| 102 class X {}'''); | |
| 103 computeFast(); | |
| 104 return computeFull((bool result) { | |
| 105 assertSuggestClass('A', | |
| 106 relevance: DART_RELEVANCE_DEFAULT, | |
| 107 kind: CompletionSuggestionKind.IDENTIFIER); | |
| 108 assertSuggestClass('B', | |
| 109 relevance: DART_RELEVANCE_DEFAULT, | |
| 110 kind: CompletionSuggestionKind.IDENTIFIER); | |
| 111 assertSuggestClass('PB', | |
| 112 relevance: DART_RELEVANCE_DEFAULT, | |
| 113 kind: CompletionSuggestionKind.IDENTIFIER); | |
| 114 assertSuggestTopLevelVar('T1', null, | |
| 115 DART_RELEVANCE_DEFAULT, CompletionSuggestionKind.IDENTIFIER); | |
| 116 assertSuggestFunction('F1', 'PB', | |
| 117 kind: CompletionSuggestionKind.IDENTIFIER); | |
| 118 assertSuggestClass('Clz', | |
| 119 relevance: DART_RELEVANCE_DEFAULT, | |
| 120 kind: CompletionSuggestionKind.IDENTIFIER); | |
| 121 assertSuggestFunctionTypeAlias('F2', null, | |
| 122 false, DART_RELEVANCE_DEFAULT, CompletionSuggestionKind.IDENTIFIER); | |
| 123 assertNotSuggested('C'); | |
| 124 assertNotSuggested('D'); | |
| 125 assertNotSuggested('X'); | |
| 126 assertNotSuggested('Object'); | |
| 127 }); | |
| 128 } | |
| 129 } | |
| OLD | NEW |