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

Side by Side Diff: pkg/analysis_server/test/context_manager_test.dart

Issue 1414863004: Stop unwanted sharing between filter closures. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 1 month 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) 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 library test.context.directory.manager; 5 library test.context.directory.manager;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 8
9 import 'package:analysis_server/src/context_manager.dart'; 9 import 'package:analysis_server/src/context_manager.dart';
10 import 'package:analyzer/file_system/file_system.dart'; 10 import 'package:analyzer/file_system/file_system.dart';
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 expect(filters, isNotNull); 155 expect(filters, isNotNull);
156 expect(filters, hasLength(1)); 156 expect(filters, hasLength(1));
157 expect( 157 expect(
158 filters.first(new AnalysisError( 158 filters.first(new AnalysisError(
159 new TestSource(), 0, 1, HintCode.UNUSED_LOCAL_VARIABLE, [ 159 new TestSource(), 0, 1, HintCode.UNUSED_LOCAL_VARIABLE, [
160 ['x'] 160 ['x']
161 ])), 161 ])),
162 isTrue); 162 isTrue);
163 } 163 }
164 164
165 test_error_filter_analysis_option_multiple_filters() async {
166 // Create files.
167 newFile(
168 [projPath, AnalysisEngine.ANALYSIS_OPTIONS_FILE],
169 r'''
170 analyzer:
171 errors:
172 invalid_assignment: ignore
173 unused_local_variable: ignore
174 ''');
175 // Setup context.
176 manager.setRoots(<String>[projPath], <String>[], <String, String>{});
177
178 // Verify filter setup.
179 List<ErrorFilter> filters =
180 callbacks.currentContext.getConfigurationData(CONFIGURED_ERROR_FILTERS);
181 expect(filters, isNotNull);
182 expect(filters, hasLength(2));
183
184 var unused_error = new AnalysisError(
185 new TestSource(), 0, 1, HintCode.UNUSED_LOCAL_VARIABLE, [
186 ['x']
187 ]);
188
189 var invalid_assignment_error =
190 new AnalysisError(new TestSource(), 0, 1, HintCode.INVALID_ASSIGNMENT, [
191 ['x'],
192 ['y']
193 ]);
194
195 expect(filters.any((filter) => filter(unused_error)), isTrue);
196 expect(filters.any((filter) => filter(invalid_assignment_error)), isTrue);
197 }
198
165 test_error_filter_analysis_option_synonyms() async { 199 test_error_filter_analysis_option_synonyms() async {
166 // Create files. 200 // Create files.
167 newFile( 201 newFile(
168 [projPath, AnalysisEngine.ANALYSIS_OPTIONS_FILE], 202 [projPath, AnalysisEngine.ANALYSIS_OPTIONS_FILE],
169 r''' 203 r'''
170 analyzer: 204 analyzer:
171 errors: 205 errors:
172 unused_local_variable: ignore 206 unused_local_variable: ignore
173 ambiguous_import: false 207 ambiguous_import: false
174 '''); 208 ''');
(...skipping 1731 matching lines...) Expand 10 before | Expand all | Expand 10 after
1906 class TestUriResolver extends UriResolver { 1940 class TestUriResolver extends UriResolver {
1907 Map<Uri, Source> uriMap; 1941 Map<Uri, Source> uriMap;
1908 1942
1909 TestUriResolver(this.uriMap); 1943 TestUriResolver(this.uriMap);
1910 1944
1911 @override 1945 @override
1912 Source resolveAbsolute(Uri uri, [Uri actualUri]) { 1946 Source resolveAbsolute(Uri uri, [Uri actualUri]) {
1913 return uriMap[uri]; 1947 return uriMap[uri];
1914 } 1948 }
1915 } 1949 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/lib/src/context_manager.dart ('k') | pkg/analyzer/lib/src/task/options.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698