| 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; | 5 library test.services.refactoring; |
| 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/correction/status.dart'; | 10 import 'package:analysis_server/src/services/correction/status.dart'; |
| 11 import 'package:analysis_server/src/services/index/index.dart'; | 11 import 'package:analysis_server/src/services/index/index.dart'; |
| 12 import 'package:analysis_server/src/services/index/local_memory_index.dart'; | 12 import 'package:analysis_server/src/services/index/local_memory_index.dart'; |
| 13 import 'package:analysis_server/src/services/refactoring/refactoring.dart'; | 13 import 'package:analysis_server/src/services/refactoring/refactoring.dart'; |
| 14 import 'package:analysis_server/src/services/search/search_engine_internal.dart'
; | 14 import 'package:analysis_server/src/services/search/search_engine_internal.dart'
; |
| 15 import 'package:analyzer/file_system/file_system.dart'; | 15 import 'package:analyzer/file_system/file_system.dart'; |
| 16 import 'package:analyzer/src/generated/ast.dart'; | 16 import 'package:analyzer/src/generated/ast.dart'; |
| 17 import 'package:analyzer/src/generated/source.dart'; | 17 import 'package:analyzer/src/generated/source.dart'; |
| 18 import 'package:unittest/unittest.dart'; | 18 import 'package:unittest/unittest.dart'; |
| 19 | 19 |
| 20 import '../../abstract_single_unit.dart'; | 20 import '../../abstract_single_unit.dart'; |
| 21 import 'package:analysis_server/src/plugin/server_plugin.dart'; |
| 22 import 'package:plugin/manager.dart'; |
| 21 | 23 |
| 22 int findIdentifierLength(String search) { | 24 int findIdentifierLength(String search) { |
| 23 int length = 0; | 25 int length = 0; |
| 24 while (length < search.length) { | 26 while (length < search.length) { |
| 25 int c = search.codeUnitAt(length); | 27 int c = search.codeUnitAt(length); |
| 26 if (!(c >= 'a'.codeUnitAt(0) && c <= 'z'.codeUnitAt(0) || | 28 if (!(c >= 'a'.codeUnitAt(0) && c <= 'z'.codeUnitAt(0) || |
| 27 c >= 'A'.codeUnitAt(0) && c <= 'Z'.codeUnitAt(0) || | 29 c >= 'A'.codeUnitAt(0) && c <= 'Z'.codeUnitAt(0) || |
| 28 c >= '0'.codeUnitAt(0) && c <= '9'.codeUnitAt(0))) { | 30 c >= '0'.codeUnitAt(0) && c <= '9'.codeUnitAt(0))) { |
| 29 break; | 31 break; |
| 30 } | 32 } |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 // prepare FileEdit | 143 // prepare FileEdit |
| 142 SourceFileEdit fileEdit = refactoringChange.getFileEdit(testFile); | 144 SourceFileEdit fileEdit = refactoringChange.getFileEdit(testFile); |
| 143 expect(fileEdit, isNotNull); | 145 expect(fileEdit, isNotNull); |
| 144 // validate resulting code | 146 // validate resulting code |
| 145 String actualCode = SourceEdit.applySequence(testCode, fileEdit.edits); | 147 String actualCode = SourceEdit.applySequence(testCode, fileEdit.edits); |
| 146 expect(actualCode, expectedCode); | 148 expect(actualCode, expectedCode); |
| 147 } | 149 } |
| 148 | 150 |
| 149 void indexTestUnit(String code) { | 151 void indexTestUnit(String code) { |
| 150 resolveTestUnit(code); | 152 resolveTestUnit(code); |
| 151 index.indexUnit(context, testUnit); | 153 index.index(context, testUnit); |
| 152 } | 154 } |
| 153 | 155 |
| 154 void indexUnit(String file, String code) { | 156 void indexUnit(String file, String code) { |
| 155 Source source = addSource(file, code); | 157 Source source = addSource(file, code); |
| 156 CompilationUnit unit = resolveLibraryUnit(source); | 158 CompilationUnit unit = resolveLibraryUnit(source); |
| 157 index.indexUnit(context, unit); | 159 index.index(context, unit); |
| 158 } | 160 } |
| 159 | 161 |
| 160 void setUp() { | 162 void setUp() { |
| 161 super.setUp(); | 163 super.setUp(); |
| 162 index = createLocalMemoryIndex(); | 164 index = createLocalMemoryIndex(); |
| 163 searchEngine = new SearchEngineImpl(index); | 165 searchEngine = new SearchEngineImpl(index); |
| 164 } | 166 } |
| 165 } | 167 } |
| OLD | NEW |