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.contributor.dart.imported_ref; | 5 library test.services.completion.contributor.dart.imported_ref; |
6 | 6 |
7 import 'package:analysis_server/plugin/protocol/protocol.dart' | 7 import 'package:analysis_server/plugin/protocol/protocol.dart' |
8 hide Element, ElementKind; | 8 hide Element, ElementKind; |
9 import 'package:analysis_server/src/protocol_server.dart'; | 9 import 'package:analysis_server/src/protocol_server.dart'; |
10 import 'package:analysis_server/src/provisional/completion/dart/completion_dart.
dart'; | 10 import 'package:analysis_server/src/provisional/completion/dart/completion_dart.
dart'; |
(...skipping 27 matching lines...) Expand all Loading... |
38 addSource('/libA.dart', 'library A; @deprecated enum E { one, two }'); | 38 addSource('/libA.dart', 'library A; @deprecated enum E { one, two }'); |
39 addTestSource('import "/libA.dart"; main() {^}'); | 39 addTestSource('import "/libA.dart"; main() {^}'); |
40 await computeSuggestions(); | 40 await computeSuggestions(); |
41 // TODO(danrube) investigate why suggestion/element is not deprecated | 41 // TODO(danrube) investigate why suggestion/element is not deprecated |
42 // when AST node has correct @deprecated annotation | 42 // when AST node has correct @deprecated annotation |
43 assertSuggestEnum('E', isDeprecated: true); | 43 assertSuggestEnum('E', isDeprecated: true); |
44 assertNotSuggested('one'); | 44 assertNotSuggested('one'); |
45 assertNotSuggested('two'); | 45 assertNotSuggested('two'); |
46 } | 46 } |
47 | 47 |
| 48 test_doc_class() async { |
| 49 addSource( |
| 50 '/libA.dart', |
| 51 r''' |
| 52 library A; |
| 53 /// My class. |
| 54 /// Short description. |
| 55 /// |
| 56 /// Longer description. |
| 57 class A {} |
| 58 '''); |
| 59 addTestSource('import "/libA.dart"; main() {^}'); |
| 60 |
| 61 await computeSuggestions(); |
| 62 |
| 63 CompletionSuggestion suggestion = assertSuggestClass('A'); |
| 64 expect(suggestion.docSummary, 'My class.\nShort description.'); |
| 65 expect(suggestion.docComplete, |
| 66 'My class.\nShort description.\n\nLonger description.'); |
| 67 } |
| 68 |
| 69 test_doc_function() async { |
| 70 resolveSource( |
| 71 '/libA.dart', |
| 72 r''' |
| 73 library A; |
| 74 /// My function. |
| 75 /// Short description. |
| 76 /// |
| 77 /// Longer description. |
| 78 int myFunc() {} |
| 79 '''); |
| 80 addTestSource('import "/libA.dart"; main() {^}'); |
| 81 |
| 82 await computeSuggestions(); |
| 83 |
| 84 CompletionSuggestion suggestion = assertSuggestFunction('myFunc', 'int'); |
| 85 expect(suggestion.docSummary, 'My function.\nShort description.'); |
| 86 expect(suggestion.docComplete, |
| 87 'My function.\nShort description.\n\nLonger description.'); |
| 88 } |
| 89 |
| 90 test_doc_function_c_style() async { |
| 91 resolveSource( |
| 92 '/libA.dart', |
| 93 r''' |
| 94 library A; |
| 95 /** |
| 96 * My function. |
| 97 * Short description. |
| 98 * |
| 99 * Longer description. |
| 100 */ |
| 101 int myFunc() {} |
| 102 '''); |
| 103 addTestSource('import "/libA.dart"; main() {^}'); |
| 104 |
| 105 await computeSuggestions(); |
| 106 |
| 107 CompletionSuggestion suggestion = assertSuggestFunction('myFunc', 'int'); |
| 108 expect(suggestion.docSummary, 'My function.\nShort description.'); |
| 109 expect(suggestion.docComplete, |
| 110 'My function.\nShort description.\n\nLonger description.'); |
| 111 } |
| 112 |
48 test_enum() async { | 113 test_enum() async { |
49 addSource('/libA.dart', 'library A; enum E { one, two }'); | 114 addSource('/libA.dart', 'library A; enum E { one, two }'); |
50 addTestSource('import "/libA.dart"; main() {^}'); | 115 addTestSource('import "/libA.dart"; main() {^}'); |
51 await computeSuggestions(); | 116 await computeSuggestions(); |
52 assertSuggestEnum('E'); | 117 assertSuggestEnum('E'); |
53 assertNotSuggested('one'); | 118 assertNotSuggested('one'); |
54 assertNotSuggested('two'); | 119 assertNotSuggested('two'); |
55 } | 120 } |
56 | 121 |
57 test_function_parameters_mixed_required_and_named() async { | 122 test_function_parameters_mixed_required_and_named() async { |
(...skipping 4243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4301 assertNotSuggested('foo2'); | 4366 assertNotSuggested('foo2'); |
4302 assertNotSuggested('bar2'); | 4367 assertNotSuggested('bar2'); |
4303 assertNotSuggested('_B'); | 4368 assertNotSuggested('_B'); |
4304 assertNotSuggested('Y'); | 4369 assertNotSuggested('Y'); |
4305 assertNotSuggested('C'); | 4370 assertNotSuggested('C'); |
4306 assertNotSuggested('f'); | 4371 assertNotSuggested('f'); |
4307 assertNotSuggested('x'); | 4372 assertNotSuggested('x'); |
4308 assertNotSuggested('e'); | 4373 assertNotSuggested('e'); |
4309 } | 4374 } |
4310 } | 4375 } |
OLD | NEW |