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

Unified Diff: pkg/analysis_server/test/analysis/notification_analysis_options_test.dart

Issue 1420363005: Error Suppression FTW. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Test fix. 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 side-by-side diff with in-line comments
Download patch
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);
« no previous file with comments | « pkg/analysis_server/lib/src/context_manager.dart ('k') | pkg/analysis_server/test/context_manager_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698