| 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 'dart:async'; | 5 import 'dart:async'; |
| 6 | 6 |
| 7 import 'package:analysis_server/protocol/protocol.dart'; | 7 import 'package:analysis_server/protocol/protocol.dart'; |
| 8 import 'package:analysis_server/protocol/protocol_generated.dart'; | 8 import 'package:analysis_server/protocol/protocol_generated.dart'; |
| 9 import 'package:analysis_server/src/domain_analysis.dart'; | 9 import 'package:analysis_server/src/domain_analysis.dart'; |
| 10 import 'package:analyzer_plugin/protocol/protocol_common.dart'; | 10 import 'package:analyzer_plugin/protocol/protocol_common.dart'; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 } | 39 } |
| 40 '''); | 40 '''); |
| 41 await waitForTasksFinished(); | 41 await waitForTasksFinished(); |
| 42 List<AnalysisError> errors = await _getErrors(testFile); | 42 List<AnalysisError> errors = await _getErrors(testFile); |
| 43 expect(errors, hasLength(1)); | 43 expect(errors, hasLength(1)); |
| 44 } | 44 } |
| 45 | 45 |
| 46 test_errorInPart() async { | 46 test_errorInPart() async { |
| 47 String libPath = '$testFolder/main.dart'; | 47 String libPath = '$testFolder/main.dart'; |
| 48 String partPath = '$testFolder/main_part.dart'; | 48 String partPath = '$testFolder/main_part.dart'; |
| 49 addFile( | 49 addFile(libPath, r''' |
| 50 libPath, | |
| 51 r''' | |
| 52 library main; | 50 library main; |
| 53 part 'main_part.dart'; | 51 part 'main_part.dart'; |
| 54 class A {} | 52 class A {} |
| 55 '''); | 53 '''); |
| 56 addFile( | 54 addFile(partPath, r''' |
| 57 partPath, | |
| 58 r''' | |
| 59 part of main; | 55 part of main; |
| 60 class A {} | 56 class A {} |
| 61 '''); | 57 '''); |
| 62 await waitForTasksFinished(); | 58 await waitForTasksFinished(); |
| 63 { | 59 { |
| 64 List<AnalysisError> libErrors = await _getErrors(libPath); | 60 List<AnalysisError> libErrors = await _getErrors(libPath); |
| 65 expect(libErrors, isEmpty); | 61 expect(libErrors, isEmpty); |
| 66 } | 62 } |
| 67 { | 63 { |
| 68 List<AnalysisError> partErrors = await _getErrors(partPath); | 64 List<AnalysisError> partErrors = await _getErrors(partPath); |
| 69 expect(partErrors, hasLength(1)); | 65 expect(partErrors, hasLength(1)); |
| 70 } | 66 } |
| 71 } | 67 } |
| 72 | 68 |
| 73 @failingTest | 69 @failingTest |
| 74 test_fileDoesNotExist() { | 70 test_fileDoesNotExist() { |
| 75 // Broken under the new driver. | 71 // Broken under the new driver. |
| 76 String file = '$projectPath/doesNotExist.dart'; | 72 String file = '$projectPath/doesNotExist.dart'; |
| 77 return _checkInvalid(file); | 73 return _checkInvalid(file); |
| 78 } | 74 } |
| 79 | 75 |
| 80 @failingTest | 76 @failingTest |
| 81 test_fileWithoutContext() { | 77 test_fileWithoutContext() { |
| 82 // Broken under the new driver. | 78 // Broken under the new driver. |
| 83 String file = '/outside.dart'; | 79 String file = '/outside.dart'; |
| 84 addFile( | 80 addFile(file, ''' |
| 85 file, | |
| 86 ''' | |
| 87 main() { | 81 main() { |
| 88 print(42); | 82 print(42); |
| 89 } | 83 } |
| 90 '''); | 84 '''); |
| 91 return _checkInvalid(file); | 85 return _checkInvalid(file); |
| 92 } | 86 } |
| 93 | 87 |
| 94 test_hasErrors() async { | 88 test_hasErrors() async { |
| 95 addTestFile(''' | 89 addTestFile(''' |
| 96 main() { | 90 main() { |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 Request _createGetErrorsRequest(String file) { | 141 Request _createGetErrorsRequest(String file) { |
| 148 return new AnalysisGetErrorsParams(file).toRequest(requestId); | 142 return new AnalysisGetErrorsParams(file).toRequest(requestId); |
| 149 } | 143 } |
| 150 | 144 |
| 151 Future<List<AnalysisError>> _getErrors(String file) async { | 145 Future<List<AnalysisError>> _getErrors(String file) async { |
| 152 Request request = _createGetErrorsRequest(file); | 146 Request request = _createGetErrorsRequest(file); |
| 153 Response response = await serverChannel.sendRequest(request); | 147 Response response = await serverChannel.sendRequest(request); |
| 154 return new AnalysisGetErrorsResult.fromResponse(response).errors; | 148 return new AnalysisGetErrorsResult.fromResponse(response).errors; |
| 155 } | 149 } |
| 156 } | 150 } |
| OLD | NEW |