| 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 import 'package:analysis_server/src/protocol_server.dart' hide Element; | 5 import 'package:analysis_server/src/protocol_server.dart' hide Element; |
| 6 import 'package:analysis_server/src/services/correction/status.dart'; | 6 import 'package:analysis_server/src/services/correction/status.dart'; |
| 7 import 'package:analysis_server/src/services/search/search_engine.dart'; | 7 import 'package:analysis_server/src/services/search/search_engine.dart'; |
| 8 import 'package:analysis_server/src/services/search/search_engine_internal.dart'
; | 8 import 'package:analysis_server/src/services/search/search_engine_internal.dart'
; |
| 9 import 'package:analyzer/dart/ast/ast.dart'; | 9 import 'package:analyzer/dart/ast/ast.dart'; |
| 10 import 'package:analyzer/dart/element/element.dart'; | 10 import 'package:analyzer/dart/element/element.dart'; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 Element element = findElement('MyClass'); | 29 Element element = findElement('MyClass'); |
| 30 // check | 30 // check |
| 31 Location location = newLocation_fromElement(element); | 31 Location location = newLocation_fromElement(element); |
| 32 expect(location.file, '/test.dart'); | 32 expect(location.file, '/test.dart'); |
| 33 expect(location.offset, 6); | 33 expect(location.offset, 6); |
| 34 expect(location.length, 7); | 34 expect(location.length, 7); |
| 35 expect(location.startLine, 1); | 35 expect(location.startLine, 1); |
| 36 expect(location.startColumn, 7); | 36 expect(location.startColumn, 7); |
| 37 } | 37 } |
| 38 | 38 |
| 39 @failingTest | |
| 40 test_createLocation_forMatch() async { | 39 test_createLocation_forMatch() async { |
| 41 // The class SearchMatchImpl has not been converted to use the new driver. | |
| 42 await resolveTestUnit('class MyClass {}'); | 40 await resolveTestUnit('class MyClass {}'); |
| 43 Element element = findElement('MyClass'); | 41 Element element = findElement('MyClass'); |
| 44 SourceRange sourceRange = range.elementName(element); | 42 SourceRange sourceRange = range.elementName(element); |
| 45 SearchMatch match = new SearchMatchImpl( | 43 SearchMatch match = new SearchMatchImpl( |
| 46 element.context, | 44 element.source.fullName, |
| 47 element.library.source.uri.toString(), | 45 element.library.source, |
| 48 element.source.uri.toString(), | 46 element.source, |
| 49 null, | 47 element.library, |
| 50 sourceRange, | 48 element, |
| 51 true, | 49 true, |
| 52 false); | 50 false, |
| 51 MatchKind.DECLARATION, |
| 52 sourceRange); |
| 53 // check | 53 // check |
| 54 Location location = newLocation_fromMatch(match); | 54 Location location = newLocation_fromMatch(match); |
| 55 expect(location.file, '/test.dart'); | 55 expect(location.file, '/test.dart'); |
| 56 expect(location.offset, sourceRange.offset); | 56 expect(location.offset, sourceRange.offset); |
| 57 expect(location.length, sourceRange.length); | 57 expect(location.length, sourceRange.length); |
| 58 } | 58 } |
| 59 | 59 |
| 60 test_createLocation_forNode() async { | 60 test_createLocation_forNode() async { |
| 61 await resolveTestUnit(''' | 61 await resolveTestUnit(''' |
| 62 main() { | 62 main() { |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 expect(refactoringStatus.severity, RefactoringProblemSeverity.FATAL); | 226 expect(refactoringStatus.severity, RefactoringProblemSeverity.FATAL); |
| 227 expect(refactoringStatus.message, 'msg'); | 227 expect(refactoringStatus.message, 'msg'); |
| 228 } | 228 } |
| 229 | 229 |
| 230 void test_newWarning() { | 230 void test_newWarning() { |
| 231 RefactoringStatus refactoringStatus = new RefactoringStatus.warning('msg'); | 231 RefactoringStatus refactoringStatus = new RefactoringStatus.warning('msg'); |
| 232 expect(refactoringStatus.severity, RefactoringProblemSeverity.WARNING); | 232 expect(refactoringStatus.severity, RefactoringProblemSeverity.WARNING); |
| 233 expect(refactoringStatus.message, 'msg'); | 233 expect(refactoringStatus.message, 'msg'); |
| 234 } | 234 } |
| 235 } | 235 } |
| OLD | NEW |