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.edit.sort_members; | 5 library test.edit.sort_members; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 | 8 |
9 import 'package:analysis_server/plugin/protocol/protocol.dart'; | 9 import 'package:analysis_server/plugin/protocol/protocol.dart'; |
10 import 'package:analysis_server/src/edit/edit_domain.dart'; | 10 import 'package:analysis_server/src/edit/edit_domain.dart'; |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 @MyAnnotation(3) | 171 @MyAnnotation(3) |
172 export 'dart:aaa'; | 172 export 'dart:aaa'; |
173 export 'dart:bbb'; | 173 export 'dart:bbb'; |
174 | 174 |
175 class MyAnnotation { | 175 class MyAnnotation { |
176 const MyAnnotation(_); | 176 const MyAnnotation(_); |
177 } | 177 } |
178 '''); | 178 '''); |
179 } | 179 } |
180 | 180 |
| 181 @failingTest |
| 182 test_OK_genericFunctionTypeInComments() async { |
| 183 addFile( |
| 184 projectPath + '/analysis_options.yaml', |
| 185 ''' |
| 186 analyzer: |
| 187 strong-mode: true |
| 188 '''); |
| 189 addTestFile(''' |
| 190 class C { |
| 191 void caller() { |
| 192 Super s = new Super(); |
| 193 takesSub(s); // <- No warning |
| 194 } |
| 195 |
| 196 void takesSub(Sub s) {} |
| 197 } |
| 198 |
| 199 class Sub extends Super {} |
| 200 |
| 201 class Super {} |
| 202 |
| 203 typedef dynamic Func(String x, String y); |
| 204 |
| 205 Function/*=F*/ allowInterop/*<F extends Function>*/(Function/*=F*/ f) => null; |
| 206 |
| 207 Func bar(Func f) { |
| 208 return allowInterop(f); |
| 209 } |
| 210 '''); |
| 211 return _assertSorted(''' |
| 212 Function/*=F*/ allowInterop/*<F extends Function>*/(Function/*=F*/ f) => null; |
| 213 |
| 214 Func bar(Func f) { |
| 215 return allowInterop(f); |
| 216 } |
| 217 |
| 218 typedef dynamic Func(String x, String y); |
| 219 |
| 220 class C { |
| 221 void caller() { |
| 222 Super s = new Super(); |
| 223 takesSub(s); // <- No warning |
| 224 } |
| 225 |
| 226 void takesSub(Sub s) {} |
| 227 } |
| 228 |
| 229 class Sub extends Super {} |
| 230 |
| 231 class Super {} |
| 232 '''); |
| 233 } |
| 234 |
181 test_OK_unitMembers_class() async { | 235 test_OK_unitMembers_class() async { |
182 addTestFile(''' | 236 addTestFile(''' |
183 class C {} | 237 class C {} |
184 class A {} | 238 class A {} |
185 class B {} | 239 class B {} |
186 '''); | 240 '''); |
187 return _assertSorted(r''' | 241 return _assertSorted(r''' |
188 class A {} | 242 class A {} |
189 class B {} | 243 class B {} |
190 class C {} | 244 class C {} |
191 '''); | 245 '''); |
192 } | 246 } |
193 | 247 |
194 Future _assertSorted(String expectedCode) async { | 248 Future _assertSorted(String expectedCode) async { |
195 await _requestSort(); | 249 await _requestSort(); |
196 String resultCode = SourceEdit.applySequence(testCode, fileEdit.edits); | 250 String resultCode = SourceEdit.applySequence(testCode, fileEdit.edits); |
197 expect(resultCode, expectedCode); | 251 expect(resultCode, expectedCode); |
198 } | 252 } |
199 | 253 |
200 Future _requestSort() async { | 254 Future _requestSort() async { |
201 Request request = new EditSortMembersParams(testFile).toRequest('0'); | 255 Request request = new EditSortMembersParams(testFile).toRequest('0'); |
202 Response response = await waitResponse(request); | 256 Response response = await waitResponse(request); |
203 var result = new EditSortMembersResult.fromResponse(response); | 257 var result = new EditSortMembersResult.fromResponse(response); |
204 fileEdit = result.edit; | 258 fileEdit = result.edit; |
205 } | 259 } |
206 } | 260 } |
OLD | NEW |