| 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 import 'package:analysis_server/src/provisional/completion/dart/completion_dart.
dart'; | 5 import 'package:analysis_server/src/provisional/completion/dart/completion_dart.
dart'; |
| 6 import 'package:analysis_server/src/services/completion/dart/combinator_contribu
tor.dart'; | 6 import 'package:analysis_server/src/services/completion/dart/combinator_contribu
tor.dart'; |
| 7 import 'package:analyzer_plugin/protocol/protocol_common.dart'; | 7 import 'package:analyzer_plugin/protocol/protocol_common.dart'; |
| 8 import 'package:test_reflective_loader/test_reflective_loader.dart'; | 8 import 'package:test_reflective_loader/test_reflective_loader.dart'; |
| 9 | 9 |
| 10 import 'completion_contributor_util.dart'; | 10 import 'completion_contributor_util.dart'; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 class E extends F { var e1; e2() { } } | 29 class E extends F { var e1; e2() { } } |
| 30 class I { int i1; i2() { } } | 30 class I { int i1; i2() { } } |
| 31 class M { var m1; int m2() { } } | 31 class M { var m1; int m2() { } } |
| 32 class A extends E implements I with M {a() {^}}'''); | 32 class A extends E implements I with M {a() {^}}'''); |
| 33 await computeSuggestions(); | 33 await computeSuggestions(); |
| 34 assertNoSuggestions(); | 34 assertNoSuggestions(); |
| 35 } | 35 } |
| 36 | 36 |
| 37 test_Combinator_hide() async { | 37 test_Combinator_hide() async { |
| 38 // SimpleIdentifier HideCombinator ImportDirective | 38 // SimpleIdentifier HideCombinator ImportDirective |
| 39 addSource( | 39 addSource('/testAB.dart', ''' |
| 40 '/testAB.dart', | |
| 41 ''' | |
| 42 library libAB; | 40 library libAB; |
| 43 part '/partAB.dart'; | 41 part '/partAB.dart'; |
| 44 class A { } | 42 class A { } |
| 45 class B { }'''); | 43 class B { }'''); |
| 46 addSource( | 44 addSource('/partAB.dart', ''' |
| 47 '/partAB.dart', | |
| 48 ''' | |
| 49 part of libAB; | 45 part of libAB; |
| 50 var T1; | 46 var T1; |
| 51 PB F1() => new PB(); | 47 PB F1() => new PB(); |
| 52 class PB { }'''); | 48 class PB { }'''); |
| 53 addSource( | 49 addSource('/testCD.dart', ''' |
| 54 '/testCD.dart', | |
| 55 ''' | |
| 56 class C { } | 50 class C { } |
| 57 class D { }'''); | 51 class D { }'''); |
| 58 addTestSource(''' | 52 addTestSource(''' |
| 59 import "/testAB.dart" hide ^; | 53 import "/testAB.dart" hide ^; |
| 60 import "/testCD.dart"; | 54 import "/testCD.dart"; |
| 61 class X {}'''); | 55 class X {}'''); |
| 62 | 56 |
| 63 await computeSuggestions(); | 57 await computeSuggestions(); |
| 64 assertSuggestClass('A', | 58 assertSuggestClass('A', |
| 65 relevance: DART_RELEVANCE_DEFAULT, | 59 relevance: DART_RELEVANCE_DEFAULT, |
| 66 kind: CompletionSuggestionKind.IDENTIFIER); | 60 kind: CompletionSuggestionKind.IDENTIFIER); |
| 67 assertSuggestClass('B', | 61 assertSuggestClass('B', |
| 68 relevance: DART_RELEVANCE_DEFAULT, | 62 relevance: DART_RELEVANCE_DEFAULT, |
| 69 kind: CompletionSuggestionKind.IDENTIFIER); | 63 kind: CompletionSuggestionKind.IDENTIFIER); |
| 70 assertSuggestClass('PB', | 64 assertSuggestClass('PB', |
| 71 relevance: DART_RELEVANCE_DEFAULT, | 65 relevance: DART_RELEVANCE_DEFAULT, |
| 72 kind: CompletionSuggestionKind.IDENTIFIER); | 66 kind: CompletionSuggestionKind.IDENTIFIER); |
| 73 assertSuggestTopLevelVar('T1', null, | 67 assertSuggestTopLevelVar('T1', null, |
| 74 kind: CompletionSuggestionKind.IDENTIFIER); | 68 kind: CompletionSuggestionKind.IDENTIFIER); |
| 75 assertSuggestFunction('F1', 'PB', | 69 assertSuggestFunction('F1', 'PB', |
| 76 kind: CompletionSuggestionKind.IDENTIFIER); | 70 kind: CompletionSuggestionKind.IDENTIFIER); |
| 77 assertNotSuggested('C'); | 71 assertNotSuggested('C'); |
| 78 assertNotSuggested('D'); | 72 assertNotSuggested('D'); |
| 79 assertNotSuggested('X'); | 73 assertNotSuggested('X'); |
| 80 assertNotSuggested('Object'); | 74 assertNotSuggested('Object'); |
| 81 } | 75 } |
| 82 | 76 |
| 83 test_Combinator_show() async { | 77 test_Combinator_show() async { |
| 84 // SimpleIdentifier HideCombinator ImportDirective | 78 // SimpleIdentifier HideCombinator ImportDirective |
| 85 addSource( | 79 addSource('/testAB.dart', ''' |
| 86 '/testAB.dart', | |
| 87 ''' | |
| 88 library libAB; | 80 library libAB; |
| 89 part '/partAB.dart'; | 81 part '/partAB.dart'; |
| 90 class A { } | 82 class A { } |
| 91 class B { } | 83 class B { } |
| 92 class _AB'''); | 84 class _AB'''); |
| 93 addSource( | 85 addSource('/partAB.dart', ''' |
| 94 '/partAB.dart', | |
| 95 ''' | |
| 96 part of libAB; | 86 part of libAB; |
| 97 var T1; | 87 var T1; |
| 98 PB F1() => new PB(); | 88 PB F1() => new PB(); |
| 99 typedef PB2 F2(int blat); | 89 typedef PB2 F2(int blat); |
| 100 class Clz = Object with Object; | 90 class Clz = Object with Object; |
| 101 class PB { }'''); | 91 class PB { }'''); |
| 102 addSource( | 92 addSource('/testCD.dart', ''' |
| 103 '/testCD.dart', | |
| 104 ''' | |
| 105 class C { } | 93 class C { } |
| 106 class D { }'''); | 94 class D { }'''); |
| 107 addTestSource(''' | 95 addTestSource(''' |
| 108 import "/testAB.dart" show ^; | 96 import "/testAB.dart" show ^; |
| 109 import "/testCD.dart"; | 97 import "/testCD.dart"; |
| 110 class X {}'''); | 98 class X {}'''); |
| 111 | 99 |
| 112 await computeSuggestions(); | 100 await computeSuggestions(); |
| 113 assertSuggestClass('A', | 101 assertSuggestClass('A', |
| 114 relevance: DART_RELEVANCE_DEFAULT, | 102 relevance: DART_RELEVANCE_DEFAULT, |
| (...skipping 20 matching lines...) Expand all Loading... |
| 135 assertNotSuggested('Object'); | 123 assertNotSuggested('Object'); |
| 136 } | 124 } |
| 137 | 125 |
| 138 test_Combinator_show_PI() async { | 126 test_Combinator_show_PI() async { |
| 139 addTestSource('import "dart:math" show ^;'); | 127 addTestSource('import "dart:math" show ^;'); |
| 140 await computeSuggestions(); | 128 await computeSuggestions(); |
| 141 assertSuggestTopLevelVar('PI', 'double', | 129 assertSuggestTopLevelVar('PI', 'double', |
| 142 kind: CompletionSuggestionKind.IDENTIFIER); | 130 kind: CompletionSuggestionKind.IDENTIFIER); |
| 143 } | 131 } |
| 144 } | 132 } |
| OLD | NEW |