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

Side by Side Diff: pkg/analysis_server/test/analysis/get_errors_test.dart

Issue 486003003: Start using code-generated protocol classes in analysis server. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 4 months 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/computer/error.dart';
10 import 'package:analysis_server/src/constants.dart'; 9 import 'package:analysis_server/src/constants.dart';
11 import 'package:analysis_server/src/domain_analysis.dart'; 10 import 'package:analysis_server/src/domain_analysis.dart';
12 import 'package:analysis_server/src/protocol.dart'; 11 import 'package:analysis_server/src/protocol.dart';
12 import 'package:analysis_server/src/protocol2.dart';
13 import 'package:analysis_testing/reflective_tests.dart'; 13 import 'package:analysis_testing/reflective_tests.dart';
14 import 'package:analyzer/file_system/file_system.dart'; 14 import 'package:analyzer/file_system/file_system.dart';
15 import 'package:unittest/unittest.dart'; 15 import 'package:unittest/unittest.dart';
16 16
17 import '../analysis_abstract.dart'; 17 import '../analysis_abstract.dart';
18 18
19 19
20 main() { 20 main() {
21 groupSep = ' | '; 21 groupSep = ' | ';
22 runReflectiveTests(GetErrorsTest); 22 runReflectiveTests(GetErrorsTest);
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 test_hasErrors() { 69 test_hasErrors() {
70 addTestFile(''' 70 addTestFile('''
71 main() { 71 main() {
72 print(42) 72 print(42)
73 } 73 }
74 '''); 74 ''');
75 return _getErrors(testFile).then((List<AnalysisError> errors) { 75 return _getErrors(testFile).then((List<AnalysisError> errors) {
76 expect(errors, hasLength(1)); 76 expect(errors, hasLength(1));
77 { 77 {
78 AnalysisError error = errors[0]; 78 AnalysisError error = errors[0];
79 expect(error.severity, 'ERROR'); 79 expect(error.severity, ErrorSeverity.ERROR);
80 expect(error.type, 'SYNTACTIC_ERROR'); 80 expect(error.type, ErrorType.SYNTACTIC_ERROR);
81 expect(error.location.file, testFile); 81 expect(error.location.file, testFile);
82 expect(error.location.startLine, 2); 82 expect(error.location.startLine, 2);
83 } 83 }
84 }); 84 });
85 } 85 }
86 86
87 test_noErrors() { 87 test_noErrors() {
88 addTestFile(''' 88 addTestFile('''
89 main() { 89 main() {
90 print(42); 90 print(42);
(...skipping 29 matching lines...) Expand all
120 120
121 Request _createGetErrorsRequest() { 121 Request _createGetErrorsRequest() {
122 Request request = new Request(requestId, ANALYSIS_GET_ERRORS); 122 Request request = new Request(requestId, ANALYSIS_GET_ERRORS);
123 request.setParameter(FILE, testFile); 123 request.setParameter(FILE, testFile);
124 return request; 124 return request;
125 } 125 }
126 126
127 Future<List<AnalysisError>> _getErrors(String file) { 127 Future<List<AnalysisError>> _getErrors(String file) {
128 Request request = _createGetErrorsRequest(); 128 Request request = _createGetErrorsRequest();
129 return serverChannel.sendRequest(request).then((Response response) { 129 return serverChannel.sendRequest(request).then((Response response) {
130 List errorsJsons = response.getResult(ERRORS); 130 return new AnalysisGetErrorsResult.fromResponse(response).errors;
131 return errorsJsons.map(AnalysisError.fromJson).toList();
132 }); 131 });
133 } 132 }
134 } 133 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/lib/src/protocol.dart ('k') | pkg/analysis_server/test/analysis/notification_errors_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698