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

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

Issue 1411013003: Analysis Options error notifications. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 2 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
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; 5 library test.analysis.notification.analysis_options;
6 6
7 import 'package:analysis_server/plugin/protocol/protocol.dart'; 7 import 'package:analysis_server/plugin/protocol/protocol.dart';
8 import 'package:analysis_server/src/constants.dart'; 8 import 'package:analysis_server/src/constants.dart';
9 import 'package:analysis_server/src/domain_analysis.dart'; 9 import 'package:analysis_server/src/domain_analysis.dart';
10 import 'package:analyzer/src/generated/engine.dart'; 10 import 'package:analyzer/src/generated/engine.dart';
(...skipping 18 matching lines...) Expand all
29 29
30 final testSource = ''' 30 final testSource = '''
31 main() { 31 main() {
32 var x = ''; 32 var x = '';
33 int y = x; // Not assignable in strong-mode 33 int y = x; // Not assignable in strong-mode
34 print(y); 34 print(y);
35 }'''; 35 }''';
36 36
37 List<AnalysisError> get errors => filesErrors[testFile]; 37 List<AnalysisError> get errors => filesErrors[testFile];
38 38
39 List<AnalysisError> get optionsFileErrors => filesErrors[optionsFilePath];
40
39 String get optionsFilePath => '$projectPath/.analysis_options'; 41 String get optionsFilePath => '$projectPath/.analysis_options';
40 42
41 AnalysisContext get testContext => server.getContainingContext(testFile); 43 AnalysisContext get testContext => server.getContainingContext(testFile);
42 44
43 void addOptionsFile(String contents) { 45 void addOptionsFile(String contents) {
44 addFile(optionsFilePath, contents); 46 addFile(optionsFilePath, contents);
45 } 47 }
46 48
47 void deleteFile(String filePath) { 49 void deleteFile(String filePath) {
48 resourceProvider.deleteFile(filePath); 50 resourceProvider.deleteFile(filePath);
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 99
98 // Add options file with strong mode enabled. 100 // Add options file with strong mode enabled.
99 setStrongMode(true); 101 setStrongMode(true);
100 102
101 await pumpEventQueue(); 103 await pumpEventQueue();
102 await waitForTasksFinished(); 104 await waitForTasksFinished();
103 105
104 verifyStrongMode(enabled: true); 106 verifyStrongMode(enabled: true);
105 } 107 }
106 108
109 test_options_file_parse_error() async {
110 addOptionsFile('''
111 ; #bang
112 ''');
113 setAnalysisRoot();
114
115 await waitForTasksFinished();
116
117 expect(optionsFileErrors, hasLength(1));
118 expect(optionsFileErrors.first.severity, AnalysisErrorSeverity.ERROR);
119 expect(optionsFileErrors.first.type, AnalysisErrorType.COMPILE_TIME_ERROR);
120 }
121
107 test_options_file_removed() async { 122 test_options_file_removed() async {
108 setStrongMode(true); 123 setStrongMode(true);
109 124
110 addTestFile(testSource); 125 addTestFile(testSource);
111 setAnalysisRoot(); 126 setAnalysisRoot();
112 127
113 await waitForTasksFinished(); 128 await waitForTasksFinished();
114 129
115 verifyStrongMode(enabled: true); 130 verifyStrongMode(enabled: true);
116 131
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 AnalysisErrorType.STATIC_TYPE_WARNING, 173 AnalysisErrorType.STATIC_TYPE_WARNING,
159 AnalysisErrorType.COMPILE_TIME_ERROR 174 AnalysisErrorType.COMPILE_TIME_ERROR
160 ])); 175 ]));
161 } else { 176 } else {
162 // Should only produce a hint. 177 // Should only produce a hint.
163 expect(errors.map((error) => error.type), 178 expect(errors.map((error) => error.type),
164 unorderedEquals([AnalysisErrorType.HINT])); 179 unorderedEquals([AnalysisErrorType.HINT]));
165 } 180 }
166 } 181 }
167 } 182 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/lib/src/status/get_handler.dart ('k') | pkg/analyzer/lib/source/analysis_options_provider.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698