| 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.analysis.get_errors; | 5 library test.analysis.get_errors; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'package:analysis_server/src/domain_analysis.dart'; | 9 import 'package:analysis_server/src/domain_analysis.dart'; |
| 10 import 'package:analysis_server/src/protocol.dart'; | 10 import 'package:analysis_server/src/protocol.dart'; |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 test_hasErrors() { | 67 test_hasErrors() { |
| 68 addTestFile(''' | 68 addTestFile(''' |
| 69 main() { | 69 main() { |
| 70 print(42) | 70 print(42) |
| 71 } | 71 } |
| 72 '''); | 72 '''); |
| 73 return _getErrors(testFile).then((List<AnalysisError> errors) { | 73 return _getErrors(testFile).then((List<AnalysisError> errors) { |
| 74 expect(errors, hasLength(1)); | 74 expect(errors, hasLength(1)); |
| 75 { | 75 { |
| 76 AnalysisError error = errors[0]; | 76 AnalysisError error = errors[0]; |
| 77 expect(error.severity, ErrorSeverity.ERROR); | 77 expect(error.severity, AnalysisErrorSeverity.ERROR); |
| 78 expect(error.type, ErrorType.SYNTACTIC_ERROR); | 78 expect(error.type, AnalysisErrorType.SYNTACTIC_ERROR); |
| 79 expect(error.location.file, testFile); | 79 expect(error.location.file, testFile); |
| 80 expect(error.location.startLine, 2); | 80 expect(error.location.startLine, 2); |
| 81 } | 81 } |
| 82 }); | 82 }); |
| 83 } | 83 } |
| 84 | 84 |
| 85 test_noErrors() { | 85 test_noErrors() { |
| 86 addTestFile(''' | 86 addTestFile(''' |
| 87 main() { | 87 main() { |
| 88 print(42); | 88 print(42); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 return new AnalysisGetErrorsParams(testFile).toRequest(requestId); | 121 return new AnalysisGetErrorsParams(testFile).toRequest(requestId); |
| 122 } | 122 } |
| 123 | 123 |
| 124 Future<List<AnalysisError>> _getErrors(String file) { | 124 Future<List<AnalysisError>> _getErrors(String file) { |
| 125 Request request = _createGetErrorsRequest(); | 125 Request request = _createGetErrorsRequest(); |
| 126 return serverChannel.sendRequest(request).then((Response response) { | 126 return serverChannel.sendRequest(request).then((Response response) { |
| 127 return new AnalysisGetErrorsResult.fromResponse(response).errors; | 127 return new AnalysisGetErrorsResult.fromResponse(response).errors; |
| 128 }); | 128 }); |
| 129 } | 129 } |
| 130 } | 130 } |
| OLD | NEW |