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