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'; |
11 import 'package:test/test.dart'; | 11 import 'package:test/test.dart'; |
12 import 'package:test_reflective_loader/test_reflective_loader.dart'; | 12 import 'package:test_reflective_loader/test_reflective_loader.dart'; |
13 | 13 |
14 import '../analysis_abstract.dart'; | 14 import '../analysis_abstract.dart'; |
15 | 15 |
16 main() { | 16 main() { |
17 defineReflectiveSuite(() { | 17 defineReflectiveSuite(() { |
18 defineReflectiveTests(GetErrorsTest); | 18 defineReflectiveTests(GetErrorsTest); |
19 }); | 19 }); |
20 } | 20 } |
21 | 21 |
22 @reflectiveTest | 22 @reflectiveTest |
23 class GetErrorsTest extends AbstractAnalysisTest { | 23 class GetErrorsTest extends AbstractAnalysisTest { |
24 static const String requestId = 'test-getError'; | 24 static const String requestId = 'test-getError'; |
25 | 25 |
26 @override | 26 @override |
27 bool get enableNewAnalysisDriver => false; | |
28 | |
29 @override | |
30 void setUp() { | 27 void setUp() { |
31 super.setUp(); | 28 super.setUp(); |
32 server.handlers = [ | 29 server.handlers = [ |
33 new AnalysisDomainHandler(server), | 30 new AnalysisDomainHandler(server), |
34 ]; | 31 ]; |
35 createProject(); | 32 createProject(); |
36 } | 33 } |
37 | 34 |
38 test_afterAnalysisComplete() async { | 35 test_afterAnalysisComplete() async { |
39 addTestFile(''' | 36 addTestFile(''' |
(...skipping 26 matching lines...) Expand all Loading... |
66 { | 63 { |
67 List<AnalysisError> libErrors = await _getErrors(libPath); | 64 List<AnalysisError> libErrors = await _getErrors(libPath); |
68 expect(libErrors, isEmpty); | 65 expect(libErrors, isEmpty); |
69 } | 66 } |
70 { | 67 { |
71 List<AnalysisError> partErrors = await _getErrors(partPath); | 68 List<AnalysisError> partErrors = await _getErrors(partPath); |
72 expect(partErrors, hasLength(1)); | 69 expect(partErrors, hasLength(1)); |
73 } | 70 } |
74 } | 71 } |
75 | 72 |
| 73 @failingTest |
76 test_fileDoesNotExist() { | 74 test_fileDoesNotExist() { |
| 75 // Broken under the new driver. |
77 String file = '$projectPath/doesNotExist.dart'; | 76 String file = '$projectPath/doesNotExist.dart'; |
78 return _checkInvalid(file); | 77 return _checkInvalid(file); |
79 } | 78 } |
80 | 79 |
| 80 @failingTest |
81 test_fileWithoutContext() { | 81 test_fileWithoutContext() { |
| 82 // Broken under the new driver. |
82 String file = '/outside.dart'; | 83 String file = '/outside.dart'; |
83 addFile( | 84 addFile( |
84 file, | 85 file, |
85 ''' | 86 ''' |
86 main() { | 87 main() { |
87 print(42); | 88 print(42); |
88 } | 89 } |
89 '''); | 90 '''); |
90 return _checkInvalid(file); | 91 return _checkInvalid(file); |
91 } | 92 } |
(...skipping 18 matching lines...) Expand all Loading... |
110 test_noErrors() async { | 111 test_noErrors() async { |
111 addTestFile(''' | 112 addTestFile(''' |
112 main() { | 113 main() { |
113 print(42); | 114 print(42); |
114 } | 115 } |
115 '''); | 116 '''); |
116 List<AnalysisError> errors = await _getErrors(testFile); | 117 List<AnalysisError> errors = await _getErrors(testFile); |
117 expect(errors, isEmpty); | 118 expect(errors, isEmpty); |
118 } | 119 } |
119 | 120 |
| 121 @failingTest |
120 test_removeContextAfterRequest() async { | 122 test_removeContextAfterRequest() async { |
| 123 // Broken under the new driver. |
121 addTestFile(''' | 124 addTestFile(''' |
122 main() { | 125 main() { |
123 print(42) | 126 print(42) |
124 } | 127 } |
125 '''); | 128 '''); |
126 // handle the request synchronously | 129 // handle the request synchronously |
127 Request request = _createGetErrorsRequest(testFile); | 130 Request request = _createGetErrorsRequest(testFile); |
128 server.handleRequest(request); | 131 server.handleRequest(request); |
129 // remove context, causes sending an "invalid file" error | 132 // remove context, causes sending an "invalid file" error |
130 resourceProvider.deleteFolder(projectPath); | 133 resourceProvider.deleteFolder(projectPath); |
(...skipping 13 matching lines...) Expand all Loading... |
144 Request _createGetErrorsRequest(String file) { | 147 Request _createGetErrorsRequest(String file) { |
145 return new AnalysisGetErrorsParams(file).toRequest(requestId); | 148 return new AnalysisGetErrorsParams(file).toRequest(requestId); |
146 } | 149 } |
147 | 150 |
148 Future<List<AnalysisError>> _getErrors(String file) async { | 151 Future<List<AnalysisError>> _getErrors(String file) async { |
149 Request request = _createGetErrorsRequest(file); | 152 Request request = _createGetErrorsRequest(file); |
150 Response response = await serverChannel.sendRequest(request); | 153 Response response = await serverChannel.sendRequest(request); |
151 return new AnalysisGetErrorsResult.fromResponse(response).errors; | 154 return new AnalysisGetErrorsResult.fromResponse(response).errors; |
152 } | 155 } |
153 } | 156 } |
OLD | NEW |