| 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.domain.analysis; | 5 library test.domain.analysis; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'package:analysis_server/src/analysis_server.dart'; | 9 import 'package:analysis_server/src/analysis_server.dart'; |
| 10 import 'package:analysis_server/src/computer/element.dart'; |
| 10 import 'package:analysis_server/src/constants.dart'; | 11 import 'package:analysis_server/src/constants.dart'; |
| 11 import 'package:analysis_server/src/domain_analysis.dart'; | 12 import 'package:analysis_server/src/domain_analysis.dart'; |
| 12 import 'package:analysis_server/src/protocol.dart'; | 13 import 'package:analysis_server/src/protocol.dart'; |
| 13 import 'package:analysis_server/src/resource.dart'; | 14 import 'package:analysis_server/src/resource.dart'; |
| 14 import 'package:analyzer/src/generated/engine.dart'; | 15 import 'package:analyzer/src/generated/engine.dart'; |
| 15 import 'package:path/path.dart'; | 16 import 'package:path/path.dart'; |
| 16 import 'package:unittest/unittest.dart'; | 17 import 'package:unittest/unittest.dart'; |
| 17 | 18 |
| 18 import 'mocks.dart'; | 19 import 'mocks.dart'; |
| 19 import 'analysis_abstract.dart'; | 20 import 'analysis_abstract.dart'; |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 this.message, this.correction); | 168 this.message, this.correction); |
| 168 | 169 |
| 169 @override | 170 @override |
| 170 String toString() { | 171 String toString() { |
| 171 return 'AnalysisError(location=$location message=$message); ' | 172 return 'AnalysisError(location=$location message=$message); ' |
| 172 'errorCode=$errorCode; severity=$separator type=$type'; | 173 'errorCode=$errorCode; severity=$separator type=$type'; |
| 173 } | 174 } |
| 174 } | 175 } |
| 175 | 176 |
| 176 | 177 |
| 177 class Location { | |
| 178 final String file; | |
| 179 final int offset; | |
| 180 final int length; | |
| 181 final int startLine; | |
| 182 final int startColumn; | |
| 183 Location(this.file, this.offset, this.length, this.startLine, | |
| 184 this.startColumn); | |
| 185 | |
| 186 @override | |
| 187 String toString() { | |
| 188 return 'Location(file=$file; offset=$offset; length=$length; ' | |
| 189 'startLine=$startLine; startColumn=$startColumn)'; | |
| 190 } | |
| 191 } | |
| 192 | |
| 193 | |
| 194 AnalysisError jsonToAnalysisError(Map<String, Object> json) { | 178 AnalysisError jsonToAnalysisError(Map<String, Object> json) { |
| 195 Map<String, Object> jsonLocation = json[LOCATION]; | 179 Map<String, Object> jsonLocation = json[LOCATION]; |
| 196 Location location = new Location(jsonLocation[FILE], _getSafeInt(jsonLocation, | 180 Location location = new Location(jsonLocation[FILE], _getSafeInt(jsonLocation, |
| 197 OFFSET, -1), _getSafeInt(jsonLocation, LENGTH, -1), _getSafeInt(jsonLocati
on, | 181 OFFSET, -1), _getSafeInt(jsonLocation, LENGTH, -1), _getSafeInt(jsonLocati
on, |
| 198 START_LINE, -1), _getSafeInt(jsonLocation, START_COLUMN, -1)); | 182 START_LINE, -1), _getSafeInt(jsonLocation, START_COLUMN, -1)); |
| 199 return new AnalysisError(json[ERROR_CODE], json[SEVERITY], json[TYPE], locatio
n, | 183 return new AnalysisError(json[ERROR_CODE], json[SEVERITY], json[TYPE], locatio
n, |
| 200 json['message'], json['correction']); | 184 json['message'], json['correction']); |
| 201 } | 185 } |
| 202 | 186 |
| 203 | 187 |
| (...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 641 }; | 625 }; |
| 642 resourceProvider.modifyFile(pkgDependency, 'new contents'); | 626 resourceProvider.modifyFile(pkgDependency, 'new contents'); |
| 643 // Let the server time to notice the file has changed, then let | 627 // Let the server time to notice the file has changed, then let |
| 644 // analysis omplete. There should now be no error. | 628 // analysis omplete. There should now be no error. |
| 645 return pumpEventQueue().then((_) => waitForTasksFinished()).then((_) { | 629 return pumpEventQueue().then((_) => waitForTasksFinished()).then((_) { |
| 646 expect(filesErrors[testFile], isEmpty); | 630 expect(filesErrors[testFile], isEmpty); |
| 647 }); | 631 }); |
| 648 }); | 632 }); |
| 649 } | 633 } |
| 650 } | 634 } |
| OLD | NEW |