Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(110)

Unified Diff: pkg/analysis_server/test/analysis/get_errors_test.dart

Issue 1477553002: Issue 25034. Record only the target source's errors. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/task/dart.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/test/analysis/get_errors_test.dart
diff --git a/pkg/analysis_server/test/analysis/get_errors_test.dart b/pkg/analysis_server/test/analysis/get_errors_test.dart
index 205cbbe00ea3ba38aebca78759d0a49a68a81835..aed7b0d1f51d75c554b2d629238dd958161ee118 100644
--- a/pkg/analysis_server/test/analysis/get_errors_test.dart
+++ b/pkg/analysis_server/test/analysis/get_errors_test.dart
@@ -43,6 +43,33 @@ main() {
});
}
+ test_errorInPart() async {
+ String libPath = '$testFolder/main.dart';
+ String partPath = '$testFolder/main_part.dart';
+ addFile(
+ libPath,
+ r'''
+library main;
+part 'main_part.dart';
+class A {}
+''');
+ addFile(
+ partPath,
+ r'''
+part of main;
+class A {}
+''');
+ await waitForTasksFinished();
+ {
+ List<AnalysisError> libErrors = await _getErrors(libPath);
+ expect(libErrors, isEmpty);
+ }
+ {
+ List<AnalysisError> partErrors = await _getErrors(partPath);
+ expect(partErrors, hasLength(1));
+ }
+ }
+
test_fileDoesNotExist() {
String file = '$projectPath/doesNotExist.dart';
return _checkInvalid(file);
@@ -96,7 +123,7 @@ main() {
}
''');
// handle the request synchronously
- Request request = _createGetErrorsRequest();
+ Request request = _createGetErrorsRequest(testFile);
server.handleRequest(request);
// remove context, causes sending an "invalid file" error
resourceProvider.deleteFolder(projectPath);
@@ -108,19 +135,19 @@ main() {
}
Future _checkInvalid(String file) {
- Request request = _createGetErrorsRequest();
+ Request request = _createGetErrorsRequest(file);
return serverChannel.sendRequest(request).then((Response response) {
expect(response.error, isNotNull);
expect(response.error.code, RequestErrorCode.GET_ERRORS_INVALID_FILE);
});
}
- Request _createGetErrorsRequest() {
- return new AnalysisGetErrorsParams(testFile).toRequest(requestId);
+ Request _createGetErrorsRequest(String file) {
+ return new AnalysisGetErrorsParams(file).toRequest(requestId);
}
Future<List<AnalysisError>> _getErrors(String file) {
- Request request = _createGetErrorsRequest();
+ Request request = _createGetErrorsRequest(file);
return serverChannel.sendRequest(request).then((Response response) {
return new AnalysisGetErrorsResult.fromResponse(response).errors;
});
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/task/dart.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698