| 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.invocation; | 5 library test.services.completion.invocation; |
| 6 | 6 |
| 7 | 7 |
| 8 import 'dart:async'; | 8 import 'dart:async'; |
| 9 | 9 |
| 10 import 'package:analysis_server/src/protocol.dart'; | 10 import 'package:analysis_server/src/protocol.dart'; |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 '''); | 125 '''); |
| 126 return computeFull((bool result) { | 126 return computeFull((bool result) { |
| 127 // TODO(paulberry): modify assertSuggestSetter so that we can pass 'int' | 127 // TODO(paulberry): modify assertSuggestSetter so that we can pass 'int' |
| 128 // as a parmeter to it, and it will check the appropriate field in | 128 // as a parmeter to it, and it will check the appropriate field in |
| 129 // the suggestion object. | 129 // the suggestion object. |
| 130 CompletionSuggestion suggestion = assertSuggestSetter('t'); | 130 CompletionSuggestion suggestion = assertSuggestSetter('t'); |
| 131 expect(suggestion.element.parameters, '(int value)'); | 131 expect(suggestion.element.parameters, '(int value)'); |
| 132 }); | 132 }); |
| 133 } | 133 } |
| 134 | 134 |
| 135 test_local() { |
| 136 addTestSource('foo() {String x = "bar"; x.^}'); |
| 137 return computeFull((bool result) { |
| 138 assertSuggestGetter('length', 'int'); |
| 139 }); |
| 140 } |
| 141 |
| 142 test_local_is() { |
| 143 addTestSource('foo() {var x; if (x is String) x.^}'); |
| 144 return computeFull((bool result) { |
| 145 assertSuggestGetter('length', 'int'); |
| 146 }); |
| 147 } |
| 148 |
| 149 test_local_propogatedType() { |
| 150 addTestSource('foo() {var x = "bar"; x.^}'); |
| 151 return computeFull((bool result) { |
| 152 assertSuggestGetter('length', 'int'); |
| 153 }); |
| 154 } |
| 155 |
| 156 test_param() { |
| 157 addTestSource('foo(String x) {x.^}'); |
| 158 return computeFull((bool result) { |
| 159 assertSuggestGetter('length', 'int'); |
| 160 }); |
| 161 } |
| 162 |
| 163 test_param_is() { |
| 164 addTestSource('foo(x) {if (x is String) x.^}'); |
| 165 return computeFull((bool result) { |
| 166 assertSuggestGetter('length', 'int'); |
| 167 }); |
| 168 } |
| 169 |
| 135 test_method_parameters_mixed_required_and_named() { | 170 test_method_parameters_mixed_required_and_named() { |
| 136 addTestSource(''' | 171 addTestSource(''' |
| 137 class C { | 172 class C { |
| 138 void m(x, {int y}) {} | 173 void m(x, {int y}) {} |
| 139 } | 174 } |
| 140 void main() {new C().^}'''); | 175 void main() {new C().^}'''); |
| 141 return computeFull((bool result) { | 176 return computeFull((bool result) { |
| 142 CompletionSuggestion suggestion = assertSuggestMethod('m', 'C', 'void'); | 177 CompletionSuggestion suggestion = assertSuggestMethod('m', 'C', 'void'); |
| 143 expect(suggestion.parameterNames, hasLength(2)); | 178 expect(suggestion.parameterNames, hasLength(2)); |
| 144 expect(suggestion.parameterNames[0], 'x'); | 179 expect(suggestion.parameterNames[0], 'x'); |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 379 } | 414 } |
| 380 void test(Derived d) { | 415 void test(Derived d) { |
| 381 d.^ | 416 d.^ |
| 382 } | 417 } |
| 383 '''); | 418 '''); |
| 384 return computeFull((bool result) { | 419 return computeFull((bool result) { |
| 385 assertSuggestMethod('f', 'Base', 'void'); | 420 assertSuggestMethod('f', 'Base', 'void'); |
| 386 }); | 421 }); |
| 387 } | 422 } |
| 388 } | 423 } |
| OLD | NEW |