| Index: pkg/analysis_server/test/analysis/notification_analysis_options_test.dart
|
| diff --git a/pkg/analysis_server/test/analysis/notification_analysis_options_test.dart b/pkg/analysis_server/test/analysis/notification_analysis_options_test.dart
|
| index 1d4c9d1db55fe0e91da7b739eba3ce820f42e764..966559be1c55192773abf5783ac362e95733b01e 100644
|
| --- a/pkg/analysis_server/test/analysis/notification_analysis_options_test.dart
|
| +++ b/pkg/analysis_server/test/analysis/notification_analysis_options_test.dart
|
| @@ -43,6 +43,8 @@ main() {
|
|
|
| AnalysisContext get testContext => server.getContainingContext(testFile);
|
|
|
| + List<AnalysisError> get testFileErrors => filesErrors[testFile];
|
| +
|
| void addOptionsFile(String contents) {
|
| addFile(optionsFilePath, contents);
|
| }
|
| @@ -83,9 +85,74 @@ analyzer:
|
| @override
|
| void tearDown() {
|
| AnalysisEngine.instance.useTaskModel = wasTaskModelEnabled;
|
| + filesErrors[optionsFilePath] = [];
|
| + filesErrors[testFile] = [];
|
| super.tearDown();
|
| }
|
|
|
| + test_error_filter() async {
|
| + addOptionsFile('''
|
| +analyzer:
|
| + errors:
|
| + unused_local_variable: ignore
|
| +''');
|
| +
|
| + addTestFile('''
|
| +main() {
|
| + String unused = "";
|
| +}
|
| +''');
|
| +
|
| + setAnalysisRoot();
|
| +
|
| + await waitForTasksFinished();
|
| +
|
| + // Verify options file.
|
| + expect(optionsFileErrors, hasLength(0));
|
| +
|
| + // Verify test file.
|
| + expect(testFileErrors, hasLength(0));
|
| + }
|
| +
|
| + test_error_filter_removed() async {
|
| + addOptionsFile('''
|
| +analyzer:
|
| + errors:
|
| + unused_local_variable: ignore
|
| +''');
|
| +
|
| + addTestFile('''
|
| +main() {
|
| + String unused = "";
|
| +}
|
| +''');
|
| +
|
| + setAnalysisRoot();
|
| +
|
| + await waitForTasksFinished();
|
| +
|
| + // Verify options file.
|
| + expect(optionsFileErrors, hasLength(0));
|
| +
|
| + // Verify test file.
|
| + expect(testFileErrors, hasLength(0));
|
| +
|
| + addOptionsFile('''
|
| +analyzer:
|
| + errors:
|
| + # unused_local_variable: ignore
|
| +''');
|
| +
|
| + await pumpEventQueue();
|
| + await waitForTasksFinished();
|
| +
|
| + // Verify options file.
|
| + expect(optionsFileErrors, hasLength(0));
|
| +
|
| + // Verify test file.
|
| + expect(testFileErrors, hasLength(1));
|
| + }
|
| +
|
| test_lint_options_changes() async {
|
| addOptionsFile('''
|
| linter:
|
| @@ -185,7 +252,7 @@ linter:
|
| verifyStrongMode(enabled: false);
|
| }
|
|
|
| - test_strong_mode_changed() async {
|
| + test_strong_mode_changed_off() async {
|
| setStrongMode(true);
|
|
|
| addTestFile(testSource);
|
| @@ -206,6 +273,24 @@ linter:
|
| verifyStrongMode(enabled: false);
|
| }
|
|
|
| + test_strong_mode_changed_on() async {
|
| + setStrongMode(false);
|
| +
|
| + addTestFile(testSource);
|
| + setAnalysisRoot();
|
| +
|
| + await waitForTasksFinished();
|
| +
|
| + verifyStrongMode(enabled: false);
|
| +
|
| + setStrongMode(true);
|
| +
|
| + await pumpEventQueue();
|
| + await waitForTasksFinished();
|
| +
|
| + verifyStrongMode(enabled: true);
|
| + }
|
| +
|
| void verifyLintsEnabled(List<String> lints) {
|
| expect(testContext.analysisOptions.lint, true);
|
| var rules = getLints(testContext).map((rule) => rule.name);
|
|
|