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.status; | 5 library test.services.correction.status; |
6 | 6 |
7 import 'package:analysis_server/src/protocol_server.dart' hide Element; | 7 import 'package:analysis_server/src/protocol_server.dart' hide Element; |
8 import 'package:analysis_server/src/services/correction/source_range.dart'; | 8 import 'package:analysis_server/src/services/correction/source_range.dart'; |
9 import 'package:analysis_server/src/services/correction/status.dart'; | 9 import 'package:analysis_server/src/services/correction/status.dart'; |
10 import 'package:analysis_server/src/services/search/search_engine.dart'; | 10 import 'package:analysis_server/src/services/search/search_engine.dart'; |
(...skipping 23 matching lines...) Expand all Loading... |
34 expect(location.offset, 6); | 34 expect(location.offset, 6); |
35 expect(location.length, 7); | 35 expect(location.length, 7); |
36 expect(location.startLine, 1); | 36 expect(location.startLine, 1); |
37 expect(location.startColumn, 7); | 37 expect(location.startColumn, 7); |
38 } | 38 } |
39 | 39 |
40 void test_createLocation_forMatch() { | 40 void test_createLocation_forMatch() { |
41 resolveTestUnit('class MyClass {}'); | 41 resolveTestUnit('class MyClass {}'); |
42 Element element = findElement('MyClass'); | 42 Element element = findElement('MyClass'); |
43 SourceRange range = rangeElementName(element); | 43 SourceRange range = rangeElementName(element); |
44 SearchMatch match = new SearchMatch(null, element, range, true, false); | 44 SearchMatch match = new SearchMatch( |
| 45 context, |
| 46 element.library.source.uri.toString(), |
| 47 element.source.uri.toString(), |
| 48 null, |
| 49 range, |
| 50 true, |
| 51 false); |
45 // check | 52 // check |
46 Location location = newLocation_fromMatch(match); | 53 Location location = newLocation_fromMatch(match); |
47 expect(location.file, '/test.dart'); | 54 expect(location.file, '/test.dart'); |
48 expect(location.offset, range.offset); | 55 expect(location.offset, range.offset); |
49 expect(location.length, range.length); | 56 expect(location.length, range.length); |
50 } | 57 } |
51 | 58 |
52 void test_createLocation_forNode() { | 59 void test_createLocation_forNode() { |
53 resolveTestUnit(''' | 60 resolveTestUnit(''' |
54 main() { | 61 main() { |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 expect(refactoringStatus.severity, RefactoringProblemSeverity.FATAL); | 225 expect(refactoringStatus.severity, RefactoringProblemSeverity.FATAL); |
219 expect(refactoringStatus.message, 'msg'); | 226 expect(refactoringStatus.message, 'msg'); |
220 } | 227 } |
221 | 228 |
222 void test_newWarning() { | 229 void test_newWarning() { |
223 RefactoringStatus refactoringStatus = new RefactoringStatus.warning('msg'); | 230 RefactoringStatus refactoringStatus = new RefactoringStatus.warning('msg'); |
224 expect(refactoringStatus.severity, RefactoringProblemSeverity.WARNING); | 231 expect(refactoringStatus.severity, RefactoringProblemSeverity.WARNING); |
225 expect(refactoringStatus.message, 'msg'); | 232 expect(refactoringStatus.message, 'msg'); |
226 } | 233 } |
227 } | 234 } |
OLD | NEW |