| 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.correction.fix; | 5 library test.services.correction.fix; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'package:analysis_server/plugin/edit/fix/fix_core.dart'; | 9 import 'package:analysis_server/plugin/edit/fix/fix_core.dart'; |
| 10 import 'package:analysis_server/plugin/edit/fix/fix_dart.dart'; | 10 import 'package:analysis_server/plugin/edit/fix/fix_dart.dart'; |
| (...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 342 r''' | 342 r''' |
| 343 // Comment first. | 343 // Comment first. |
| 344 // Comment second. | 344 // Comment second. |
| 345 | 345 |
| 346 part of my.lib; | 346 part of my.lib; |
| 347 | 347 |
| 348 class A {} | 348 class A {} |
| 349 '''); | 349 '''); |
| 350 } | 350 } |
| 351 | 351 |
| 352 test_addSync_asyncFor() async { |
| 353 resolveTestUnit(''' |
| 354 import 'dart:async'; |
| 355 main(Stream<String> names) { |
| 356 await for (String name in names) { |
| 357 print(name); |
| 358 } |
| 359 } |
| 360 '''); |
| 361 await assertHasFix( |
| 362 DartFixKind.ADD_ASYNC, |
| 363 ''' |
| 364 import 'dart:async'; |
| 365 main(Stream<String> names) async { |
| 366 await for (String name in names) { |
| 367 print(name); |
| 368 } |
| 369 } |
| 370 '''); |
| 371 } |
| 372 |
| 352 test_addSync_BAD_nullFunctionBody() async { | 373 test_addSync_BAD_nullFunctionBody() async { |
| 353 resolveTestUnit(''' | 374 resolveTestUnit(''' |
| 354 var F = await; | 375 var F = await; |
| 355 '''); | 376 '''); |
| 356 await assertNoFix(DartFixKind.ADD_ASYNC); | 377 await assertNoFix(DartFixKind.ADD_ASYNC); |
| 357 } | 378 } |
| 358 | 379 |
| 359 test_addSync_blockFunctionBody() async { | 380 test_addSync_blockFunctionBody() async { |
| 360 resolveTestUnit(''' | 381 resolveTestUnit(''' |
| 361 foo() {} | 382 foo() {} |
| (...skipping 4452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4814 int offset = resultCode.indexOf(search); | 4835 int offset = resultCode.indexOf(search); |
| 4815 positions.add(new Position(testFile, offset)); | 4836 positions.add(new Position(testFile, offset)); |
| 4816 } | 4837 } |
| 4817 return positions; | 4838 return positions; |
| 4818 } | 4839 } |
| 4819 | 4840 |
| 4820 void _performAnalysis() { | 4841 void _performAnalysis() { |
| 4821 while (context.performAnalysisTask().hasMoreWork); | 4842 while (context.performAnalysisTask().hasMoreWork); |
| 4822 } | 4843 } |
| 4823 } | 4844 } |
| OLD | NEW |