| 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 14 matching lines...) Expand all Loading... |
| 25 class GetErrorsTest extends AbstractAnalysisTest { | 25 class GetErrorsTest extends AbstractAnalysisTest { |
| 26 static const String requestId = 'test-getError'; | 26 static const String requestId = 'test-getError'; |
| 27 | 27 |
| 28 @override | 28 @override |
| 29 void setUp() { | 29 void setUp() { |
| 30 super.setUp(); | 30 super.setUp(); |
| 31 server.handlers = [new AnalysisDomainHandler(server),]; | 31 server.handlers = [new AnalysisDomainHandler(server),]; |
| 32 createProject(); | 32 createProject(); |
| 33 } | 33 } |
| 34 | 34 |
| 35 // TODO (danrubel) investigate why this is failing | 35 test_afterAnalysisComplete() { |
| 36 // test_afterAnalysisComplete() { | 36 addTestFile(''' |
| 37 // addTestFile(''' | 37 main() { |
| 38 //main() { | 38 print(42) |
| 39 // print(42) | 39 } |
| 40 //} | 40 '''); |
| 41 //'''); | 41 return waitForTasksFinished().then((_) { |
| 42 // return waitForTasksFinished().then((_) { | 42 return _getErrors(testFile).then((List<AnalysisError> errors) { |
| 43 // return _getErrors(testFile).then((List<AnalysisError> errors) { | 43 expect(errors, hasLength(1)); |
| 44 // expect(errors, hasLength(1)); | 44 }); |
| 45 // }); | 45 }); |
| 46 // }); | 46 } |
| 47 // } | |
| 48 | 47 |
| 49 test_fileDoesNotExist() { | 48 test_fileDoesNotExist() { |
| 50 String file = '$projectPath/doesNotExist.dart'; | 49 String file = '$projectPath/doesNotExist.dart'; |
| 51 return _checkInvalid(file); | 50 return _checkInvalid(file); |
| 52 } | 51 } |
| 53 | 52 |
| 54 test_fileWithoutContext() { | 53 test_fileWithoutContext() { |
| 55 String file = '/outside.dart'; | 54 String file = '/outside.dart'; |
| 56 addFile(file, ''' | 55 addFile(file, ''' |
| 57 main() { | 56 main() { |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 return new AnalysisGetErrorsParams(testFile).toRequest(requestId); | 122 return new AnalysisGetErrorsParams(testFile).toRequest(requestId); |
| 124 } | 123 } |
| 125 | 124 |
| 126 Future<List<AnalysisError>> _getErrors(String file) { | 125 Future<List<AnalysisError>> _getErrors(String file) { |
| 127 Request request = _createGetErrorsRequest(); | 126 Request request = _createGetErrorsRequest(); |
| 128 return serverChannel.sendRequest(request).then((Response response) { | 127 return serverChannel.sendRequest(request).then((Response response) { |
| 129 return new AnalysisGetErrorsResult.fromResponse(response).errors; | 128 return new AnalysisGetErrorsResult.fromResponse(response).errors; |
| 130 }); | 129 }); |
| 131 } | 130 } |
| 132 } | 131 } |
| OLD | NEW |