| 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.toplevel; | 5 library test.services.completion.toplevel; |
| 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/imported_computer.dart'; | 8 import 'package:analysis_server/src/services/completion/imported_computer.dart'; |
| 9 import '../../reflective_tests.dart'; | 9 import '../../reflective_tests.dart'; |
| 10 import 'package:unittest/unittest.dart'; | 10 import 'package:unittest/unittest.dart'; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 return computeFull().then((_) { | 31 return computeFull().then((_) { |
| 32 assertSuggestClass('A'); | 32 assertSuggestClass('A'); |
| 33 assertNotSuggested('x'); | 33 assertNotSuggested('x'); |
| 34 assertNotSuggested('_B'); | 34 assertNotSuggested('_B'); |
| 35 // Should not suggest compilation unit elements | 35 // Should not suggest compilation unit elements |
| 36 // which are returned by the LocalComputer | 36 // which are returned by the LocalComputer |
| 37 assertNotSuggested('C'); | 37 assertNotSuggested('C'); |
| 38 }); | 38 }); |
| 39 } | 39 } |
| 40 | 40 |
| 41 test_function() { |
| 42 addSource('/testA.dart', '@deprecated A() {int x;} _B() {}'); |
| 43 addTestSource('import "/testA.dart"; class C {foo(){^}}'); |
| 44 return computeFull().then((_) { |
| 45 assertSuggestFunction('A', null, true); |
| 46 assertNotSuggested('x'); |
| 47 assertNotSuggested('_B'); |
| 48 // Should not suggest compilation unit elements |
| 49 // which are returned by the LocalComputer |
| 50 assertNotSuggested('C'); |
| 51 }); |
| 52 } |
| 53 |
| 41 test_class_importHide() { | 54 test_class_importHide() { |
| 42 addSource('/testA.dart', 'class A { } class B { }'); | 55 addSource('/testA.dart', 'class A { } class B { }'); |
| 43 addTestSource('import "/testA.dart" hide ^; class C {}'); | 56 addTestSource('import "/testA.dart" hide ^; class C {}'); |
| 44 return computeFull().then((_) { | 57 return computeFull().then((_) { |
| 45 assertSuggestClass('A'); | 58 assertSuggestClass('A'); |
| 46 assertSuggestClass('B'); | 59 assertSuggestClass('B'); |
| 47 assertNotSuggested('Object'); | 60 assertNotSuggested('Object'); |
| 48 }); | 61 }); |
| 49 } | 62 } |
| 50 | 63 |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 | 209 |
| 197 test_topLevelVar_notImported() { | 210 test_topLevelVar_notImported() { |
| 198 addSource('/testA.dart', 'var T1; var _T2;'); | 211 addSource('/testA.dart', 'var T1; var _T2;'); |
| 199 addTestSource('class C {foo(){^}}'); | 212 addTestSource('class C {foo(){^}}'); |
| 200 return computeFull(true).then((_) { | 213 return computeFull(true).then((_) { |
| 201 assertSuggestTopLevelVar('T1', null, CompletionRelevance.LOW); | 214 assertSuggestTopLevelVar('T1', null, CompletionRelevance.LOW); |
| 202 assertNotSuggested('_T2'); | 215 assertNotSuggested('_T2'); |
| 203 }); | 216 }); |
| 204 } | 217 } |
| 205 } | 218 } |
| OLD | NEW |