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

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

Issue 2577913002: Apply error processors in the new driver (Closed)
Patch Set: Created 4 years 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
« no previous file with comments | « pkg/analysis_server/lib/src/computer/new_notifications.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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.notification_analysis_options_test; 5 library test.analysis.notification_analysis_options_test;
6 6
7 import 'package:analysis_server/plugin/protocol/protocol.dart' 7 import 'package:analysis_server/plugin/protocol/protocol.dart'
8 hide AnalysisOptions; 8 hide AnalysisOptions;
9 import 'package:analysis_server/src/constants.dart'; 9 import 'package:analysis_server/src/constants.dart';
10 import 'package:analysis_server/src/domain_analysis.dart'; 10 import 'package:analysis_server/src/domain_analysis.dart';
11 import 'package:analyzer/src/generated/engine.dart'; 11 import 'package:analyzer/src/generated/engine.dart';
12 import 'package:linter/src/rules.dart'; 12 import 'package:linter/src/rules.dart';
13 import 'package:test/test.dart'; 13 import 'package:test/test.dart';
14 import 'package:test_reflective_loader/test_reflective_loader.dart'; 14 import 'package:test_reflective_loader/test_reflective_loader.dart';
15 15
16 import '../analysis_abstract.dart'; 16 import '../analysis_abstract.dart';
17 import '../mocks.dart'; 17 import '../mocks.dart';
18 18
19 main() { 19 main() {
20 defineReflectiveSuite(() { 20 defineReflectiveSuite(() {
21 defineReflectiveTests(NewAnalysisOptionsFileNotificationTest); 21 defineReflectiveTests(NewAnalysisOptionsFileNotificationTest);
22 defineReflectiveTests(OldAnalysisOptionsFileNotificationTest); 22 defineReflectiveTests(OldAnalysisOptionsFileNotificationTest);
23 // These tests all fail, presumably because we are not updating the analysis 23 defineReflectiveTests(NewAnalysisOptionsFileNotificationTest_Driver);
24 // options when the file changes and because we are not analyzing the 24 defineReflectiveTests(OldAnalysisOptionsFileNotificationTest_Driver);
25 // analysis options file.
26 // defineReflectiveTests(NewAnalysisOptionsFileNotificationTest_Driver);
27 // defineReflectiveTests(OldAnalysisOptionsFileNotificationTest_Driver);
28 }); 25 });
29 } 26 }
30 27
31 abstract class AnalysisOptionsFileNotificationTest 28 abstract class AnalysisOptionsFileNotificationTest
32 extends AbstractAnalysisTest { 29 extends AbstractAnalysisTest {
33 Map<String, List<AnalysisError>> filesErrors = {}; 30 Map<String, List<AnalysisError>> filesErrors = {};
34 31
35 final testSource = ''' 32 final testSource = '''
36 main() { 33 main() {
37 var x = ''; 34 var x = '';
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 main() { 98 main() {
102 String unused = ""; 99 String unused = "";
103 } 100 }
104 '''); 101 ''');
105 102
106 setAnalysisRoot(); 103 setAnalysisRoot();
107 104
108 await waitForTasksFinished(); 105 await waitForTasksFinished();
109 106
110 // Verify options file. 107 // Verify options file.
111 expect(optionsFileErrors, isNotNull); 108 if (!enableNewAnalysisDriver) {
112 expect(optionsFileErrors, isEmpty); 109 // TODO(brianwilkerson) Implement options file analysis in the new driver.
110 expect(optionsFileErrors, isNotNull);
111 expect(optionsFileErrors, isEmpty);
112 }
113 113
114 // Verify test file. 114 // Verify test file.
115 expect(testFileErrors, isNotNull); 115 expect(testFileErrors, isNotNull);
116 expect(testFileErrors, isEmpty); 116 expect(testFileErrors, isEmpty);
117 } 117 }
118 118
119 test_error_filter_removed() async { 119 test_error_filter_removed() async {
120 addOptionsFile(''' 120 addOptionsFile('''
121 analyzer: 121 analyzer:
122 errors: 122 errors:
123 unused_local_variable: ignore 123 unused_local_variable: ignore
124 '''); 124 ''');
125 125
126 addTestFile(''' 126 addTestFile('''
127 main() { 127 main() {
128 String unused = ""; 128 String unused = "";
129 } 129 }
130 '''); 130 ''');
131 131
132 setAnalysisRoot(); 132 setAnalysisRoot();
133 133
134 await waitForTasksFinished(); 134 await waitForTasksFinished();
135 135
136 // Verify options file. 136 // Verify options file.
137 expect(optionsFileErrors, isNotNull); 137 if (!enableNewAnalysisDriver) {
138 expect(optionsFileErrors, isEmpty); 138 // TODO(brianwilkerson) Implement options file analysis in the new driver.
139 expect(optionsFileErrors, isNotNull);
140 expect(optionsFileErrors, isEmpty);
141 }
139 142
140 // Verify test file. 143 // Verify test file.
141 expect(testFileErrors, isNotNull); 144 expect(testFileErrors, isNotNull);
142 expect(testFileErrors, isEmpty); 145 expect(testFileErrors, isEmpty);
143 146
144 addOptionsFile(''' 147 addOptionsFile('''
145 analyzer: 148 analyzer:
146 errors: 149 errors:
147 # unused_local_variable: ignore 150 # unused_local_variable: ignore
148 '''); 151 ''');
149 152
150 await pumpEventQueue(); 153 await pumpEventQueue();
151 await waitForTasksFinished(); 154 await waitForTasksFinished();
152 155
153 // Verify options file. 156 // Verify options file.
154 expect(optionsFileErrors, isEmpty); 157 if (!enableNewAnalysisDriver) {
158 // TODO(brianwilkerson) Implement options file analysis in the new driver.
159 expect(optionsFileErrors, isEmpty);
160 }
155 161
156 // Verify test file. 162 // Verify test file.
157 expect(testFileErrors, hasLength(1)); 163 expect(testFileErrors, hasLength(1));
158 } 164 }
159 165
160 test_lint_options_changes() async { 166 test_lint_options_changes() async {
161 addOptionsFile(''' 167 addOptionsFile('''
162 linter: 168 linter:
163 rules: 169 rules:
164 - camel_case_types 170 - camel_case_types
(...skipping 24 matching lines...) Expand all
189 linter: 195 linter:
190 rules: 196 rules:
191 - unsupported 197 - unsupported
192 '''); 198 ''');
193 199
194 addTestFile(testSource); 200 addTestFile(testSource);
195 setAnalysisRoot(); 201 setAnalysisRoot();
196 202
197 await waitForTasksFinished(); 203 await waitForTasksFinished();
198 204
199 expect(optionsFileErrors, hasLength(1)); 205 if (!enableNewAnalysisDriver) {
200 expect(optionsFileErrors.first.severity, AnalysisErrorSeverity.WARNING); 206 // TODO(brianwilkerson) Implement options file analysis in the new driver.
201 expect(optionsFileErrors.first.type, AnalysisErrorType.STATIC_WARNING); 207 expect(optionsFileErrors, hasLength(1));
208 expect(optionsFileErrors.first.severity, AnalysisErrorSeverity.WARNING);
209 expect(optionsFileErrors.first.type, AnalysisErrorType.STATIC_WARNING);
210 }
202 } 211 }
203 212
204 test_options_file_added() async { 213 test_options_file_added() async {
205 addTestFile(testSource); 214 addTestFile(testSource);
206 setAnalysisRoot(); 215 setAnalysisRoot();
207 216
208 await waitForTasksFinished(); 217 await waitForTasksFinished();
209 218
210 // Verify strong-mode disabled. 219 // Verify strong-mode disabled.
211 verifyStrongMode(enabled: false); 220 verifyStrongMode(enabled: false);
(...skipping 11 matching lines...) Expand all
223 } 232 }
224 233
225 test_options_file_parse_error() async { 234 test_options_file_parse_error() async {
226 addOptionsFile(''' 235 addOptionsFile('''
227 ; #bang 236 ; #bang
228 '''); 237 ''');
229 setAnalysisRoot(); 238 setAnalysisRoot();
230 239
231 await waitForTasksFinished(); 240 await waitForTasksFinished();
232 241
233 expect(optionsFileErrors, hasLength(1)); 242 if (!enableNewAnalysisDriver) {
234 expect(optionsFileErrors.first.severity, AnalysisErrorSeverity.ERROR); 243 // TODO(brianwilkerson) Implement options file analysis in the new driver.
235 expect(optionsFileErrors.first.type, AnalysisErrorType.COMPILE_TIME_ERROR); 244 expect(optionsFileErrors, hasLength(1));
245 expect(optionsFileErrors.first.severity, AnalysisErrorSeverity.ERROR);
246 expect(
247 optionsFileErrors.first.type, AnalysisErrorType.COMPILE_TIME_ERROR);
248 }
236 } 249 }
237 250
238 test_options_file_removed() async { 251 test_options_file_removed() async {
239 setStrongMode(true); 252 setStrongMode(true);
240 253
241 addTestFile(testSource); 254 addTestFile(testSource);
242 setAnalysisRoot(); 255 setAnalysisRoot();
243 256
244 await waitForTasksFinished(); 257 await waitForTasksFinished();
245 258
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 @reflectiveTest 359 @reflectiveTest
347 class OldAnalysisOptionsFileNotificationTest_Driver 360 class OldAnalysisOptionsFileNotificationTest_Driver
348 extends OldAnalysisOptionsFileNotificationTest { 361 extends OldAnalysisOptionsFileNotificationTest {
349 @override 362 @override
350 void setUp() { 363 void setUp() {
351 enableNewAnalysisDriver = true; 364 enableNewAnalysisDriver = true;
352 generateSummaryFiles = true; 365 generateSummaryFiles = true;
353 super.setUp(); 366 super.setUp();
354 } 367 }
355 } 368 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/lib/src/computer/new_notifications.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698