| 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 1475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1486 // validate change | 1486 // validate change |
| 1487 List<SourceFileEdit> fileEdits = change.edits; | 1487 List<SourceFileEdit> fileEdits = change.edits; |
| 1488 expect(fileEdits, hasLength(1)); | 1488 expect(fileEdits, hasLength(1)); |
| 1489 SourceFileEdit fileEdit = change.edits[0]; | 1489 SourceFileEdit fileEdit = change.edits[0]; |
| 1490 expect(fileEdit.file, '/my/project/bin/my_file.dart'); | 1490 expect(fileEdit.file, '/my/project/bin/my_file.dart'); |
| 1491 expect(fileEdit.fileStamp, -1); | 1491 expect(fileEdit.fileStamp, -1); |
| 1492 expect(fileEdit.edits, hasLength(1)); | 1492 expect(fileEdit.edits, hasLength(1)); |
| 1493 expect(fileEdit.edits[0].replacement, contains('library my_file;')); | 1493 expect(fileEdit.edits[0].replacement, contains('library my_file;')); |
| 1494 } | 1494 } |
| 1495 | 1495 |
| 1496 test_createFile_forImport_BAD_inPackage_lib_justLib() async { |
| 1497 provider.newFile('/projects/my_package/pubspec.yaml', 'name: my_package'); |
| 1498 testFile = '/projects/my_package/test.dart'; |
| 1499 resolveTestUnit(''' |
| 1500 import 'lib'; |
| 1501 '''); |
| 1502 await assertNoFix(DartFixKind.CREATE_FILE); |
| 1503 } |
| 1504 |
| 1505 test_createFile_forImport_BAD_notDart() async { |
| 1506 testFile = '/my/project/bin/test.dart'; |
| 1507 resolveTestUnit(''' |
| 1508 import 'my_file.txt'; |
| 1509 '''); |
| 1510 await assertNoFix(DartFixKind.CREATE_FILE); |
| 1511 } |
| 1512 |
| 1496 test_createFile_forImport_inPackage_lib() async { | 1513 test_createFile_forImport_inPackage_lib() async { |
| 1497 provider.newFile('/projects/my_package/pubspec.yaml', 'name: my_package'); | 1514 provider.newFile('/projects/my_package/pubspec.yaml', 'name: my_package'); |
| 1498 testFile = '/projects/my_package/lib/test.dart'; | 1515 testFile = '/projects/my_package/lib/test.dart'; |
| 1499 provider.newFolder('/projects/my_package/lib'); | 1516 provider.newFolder('/projects/my_package/lib'); |
| 1500 resolveTestUnit(''' | 1517 resolveTestUnit(''' |
| 1501 import 'a/bb/c_cc/my_lib.dart'; | 1518 import 'a/bb/c_cc/my_lib.dart'; |
| 1502 '''); | 1519 '''); |
| 1503 AnalysisError error = _findErrorToFix(); | 1520 AnalysisError error = _findErrorToFix(); |
| 1504 fix = await _assertHasFix(DartFixKind.CREATE_FILE, error); | 1521 fix = await _assertHasFix(DartFixKind.CREATE_FILE, error); |
| 1505 change = fix.change; | 1522 change = fix.change; |
| (...skipping 3200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4706 int offset = resultCode.indexOf(search); | 4723 int offset = resultCode.indexOf(search); |
| 4707 positions.add(new Position(testFile, offset)); | 4724 positions.add(new Position(testFile, offset)); |
| 4708 } | 4725 } |
| 4709 return positions; | 4726 return positions; |
| 4710 } | 4727 } |
| 4711 | 4728 |
| 4712 void _performAnalysis() { | 4729 void _performAnalysis() { |
| 4713 while (context.performAnalysisTask().hasMoreWork); | 4730 while (context.performAnalysisTask().hasMoreWork); |
| 4714 } | 4731 } |
| 4715 } | 4732 } |
| OLD | NEW |