| 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.refactoring.move_files; | 5 library test.services.refactoring.move_files; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'package:analysis_server/src/protocol.dart'; | 9 import 'package:analysis_server/src/protocol.dart'; |
| 10 import 'package:analysis_server/src/services/refactoring/refactoring.dart'; | 10 import 'package:analysis_server/src/services/refactoring/refactoring.dart'; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 String pathC = '/project/000/1111/22/c.dart'; | 31 String pathC = '/project/000/1111/22/c.dart'; |
| 32 String pathD = '/project/000/1111/333/d.dart'; | 32 String pathD = '/project/000/1111/333/d.dart'; |
| 33 testFile = '/project/000/1111/test.dart'; | 33 testFile = '/project/000/1111/test.dart'; |
| 34 addSource('/absolute/uri.dart', ''); | 34 addSource('/absolute/uri.dart', ''); |
| 35 addSource(pathA, 'part of lib;'); | 35 addSource(pathA, 'part of lib;'); |
| 36 addSource(pathB, "import 'test.dart';"); | 36 addSource(pathB, "import 'test.dart';"); |
| 37 addSource(pathC, ''); | 37 addSource(pathC, ''); |
| 38 addSource(pathD, ''); | 38 addSource(pathD, ''); |
| 39 addTestSource(''' | 39 addTestSource(''' |
| 40 library lib; | 40 library lib; |
| 41 import 'dart:math'; |
| 41 import '22/c.dart'; | 42 import '22/c.dart'; |
| 42 export '333/d.dart'; | 43 export '333/d.dart'; |
| 43 part 'a.dart'; | 44 part 'a.dart'; |
| 44 part '/absolute/uri.dart'; | 45 part '/absolute/uri.dart'; |
| 45 '''); | 46 '''); |
| 46 _performAnalysis(); | 47 _performAnalysis(); |
| 47 // perform refactoring | 48 // perform refactoring |
| 48 _createRefactoring('/project/000/1111/22/new_name.dart'); | 49 _createRefactoring('/project/000/1111/22/new_name.dart'); |
| 49 return _assertSuccessfulRefactoring().then((_) { | 50 return _assertSuccessfulRefactoring().then((_) { |
| 50 assertNoFileChange(pathA); | 51 assertNoFileChange(pathA); |
| 51 assertFileChangeResult(pathB, "import '22/new_name.dart';"); | 52 assertFileChangeResult(pathB, "import '22/new_name.dart';"); |
| 52 assertNoFileChange(pathC); | 53 assertNoFileChange(pathC); |
| 53 assertFileChangeResult(testFile, ''' | 54 assertFileChangeResult(testFile, ''' |
| 54 library lib; | 55 library lib; |
| 56 import 'dart:math'; |
| 55 import 'c.dart'; | 57 import 'c.dart'; |
| 56 export '../333/d.dart'; | 58 export '../333/d.dart'; |
| 57 part '../a.dart'; | 59 part '../a.dart'; |
| 58 part '/absolute/uri.dart'; | 60 part '/absolute/uri.dart'; |
| 59 '''); | 61 '''); |
| 60 }); | 62 }); |
| 61 } | 63 } |
| 62 | 64 |
| 63 test_importedLibrary() { | 65 test_importedLibrary() { |
| 64 String pathA = '/project/000/1111/a.dart'; | 66 String pathA = '/project/000/1111/a.dart'; |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 break; | 182 break; |
| 181 } | 183 } |
| 182 for (ChangeNotice notice in result.changeNotices) { | 184 for (ChangeNotice notice in result.changeNotices) { |
| 183 if (notice.source.fullName.startsWith('/project/')) { | 185 if (notice.source.fullName.startsWith('/project/')) { |
| 184 index.indexUnit(context, notice.compilationUnit); | 186 index.indexUnit(context, notice.compilationUnit); |
| 185 } | 187 } |
| 186 } | 188 } |
| 187 } | 189 } |
| 188 } | 190 } |
| 189 } | 191 } |
| OLD | NEW |