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

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

Issue 1507813004: Remove unnecessary 'noSuchMethod' declarations. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 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 | « no previous file | pkg/analysis_server/test/mocks.dart » ('j') | 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.updateContent; 5 library test.analysis.updateContent;
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/analysis_server.dart'; 8 import 'package:analysis_server/src/analysis_server.dart';
9 import 'package:analysis_server/src/constants.dart'; 9 import 'package:analysis_server/src/constants.dart';
10 import 'package:analysis_server/src/services/index/index.dart'; 10 import 'package:analysis_server/src/services/index/index.dart';
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 library bar; 125 library bar;
126 import 'baz.dart'; 126 import 'baz.dart';
127 main() { f(); }'''); 127 main() { f(); }''');
128 String bazPath = '/project2/baz.dart'; 128 String bazPath = '/project2/baz.dart';
129 resourceProvider.newFile( 129 resourceProvider.newFile(
130 bazPath, 130 bazPath,
131 ''' 131 '''
132 library baz; 132 library baz;
133 f(int i) {} 133 f(int i) {}
134 '''); 134 ''');
135 Request request = new AnalysisSetAnalysisRootsParams( 135 Request request =
136 ['/project1', '/project2'], []).toRequest('0'); 136 new AnalysisSetAnalysisRootsParams(['/project1', '/project2'], [])
137 .toRequest('0');
137 handleSuccessfulRequest(request); 138 handleSuccessfulRequest(request);
138 { 139 {
139 await server.onAnalysisComplete; 140 await server.onAnalysisComplete;
140 // Files foo.dart and bar.dart should both have errors, since they both 141 // Files foo.dart and bar.dart should both have errors, since they both
141 // call f() with the wrong number of arguments. 142 // call f() with the wrong number of arguments.
142 expect(filesErrors[fooPath], hasLength(1)); 143 expect(filesErrors[fooPath], hasLength(1));
143 expect(filesErrors[barPath], hasLength(1)); 144 expect(filesErrors[barPath], hasLength(1));
144 // Overlay the content of baz.dart to eliminate the errors. 145 // Overlay the content of baz.dart to eliminate the errors.
145 server.updateContent('1', { 146 server.updateContent('1', {
146 bazPath: new AddContentOverlay(''' 147 bazPath: new AddContentOverlay('''
147 library baz; 148 library baz;
148 f() {} 149 f() {}
149 ''') 150 ''')
150 }); 151 });
151 } 152 }
152 { 153 {
153 await server.onAnalysisComplete; 154 await server.onAnalysisComplete;
154 // The overlay should have been propagated to both contexts, causing both 155 // The overlay should have been propagated to both contexts, causing both
155 // foo.dart and bar.dart to be reanalyzed and found to be free of errors. 156 // foo.dart and bar.dart to be reanalyzed and found to be free of errors.
156 expect(filesErrors[fooPath], isEmpty); 157 expect(filesErrors[fooPath], isEmpty);
157 expect(filesErrors[barPath], isEmpty); 158 expect(filesErrors[barPath], isEmpty);
158 } 159 }
159 } 160 }
160 161
161 test_overlayOnly() async { 162 test_overlayOnly() async {
162 String filePath = '/User/project1/test.dart'; 163 String filePath = '/User/project1/test.dart';
163 Folder folder1 = resourceProvider.newFolder('/User/project1'); 164 Folder folder1 = resourceProvider.newFolder('/User/project1');
164 Folder folder2 = resourceProvider.newFolder('/User/project2'); 165 Folder folder2 = resourceProvider.newFolder('/User/project2');
165 Request request = new AnalysisSetAnalysisRootsParams( 166 Request request =
166 [folder1.path, folder2.path], []).toRequest('0'); 167 new AnalysisSetAnalysisRootsParams([folder1.path, folder2.path], [])
168 .toRequest('0');
167 handleSuccessfulRequest(request); 169 handleSuccessfulRequest(request);
168 // exactly 2 contexts 170 // exactly 2 contexts
169 expect(server.folderMap, hasLength(2)); 171 expect(server.folderMap, hasLength(2));
170 AnalysisContext context1 = server.folderMap[folder1]; 172 AnalysisContext context1 = server.folderMap[folder1];
171 AnalysisContext context2 = server.folderMap[folder2]; 173 AnalysisContext context2 = server.folderMap[folder2];
172 // no sources 174 // no sources
173 expect(_getUserSources(context1), isEmpty); 175 expect(_getUserSources(context1), isEmpty);
174 expect(_getUserSources(context2), isEmpty); 176 expect(_getUserSources(context2), isEmpty);
175 // add an overlay - new Source in context1 177 // add an overlay - new Source in context1
176 server.updateContent('1', {filePath: new AddContentOverlay('')}); 178 server.updateContent('1', {filePath: new AddContentOverlay('')});
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 final String file; 265 final String file;
264 266
265 _ArgumentMatcher_CompilationUnit(this.file); 267 _ArgumentMatcher_CompilationUnit(this.file);
266 268
267 @override 269 @override
268 bool matches(arg) { 270 bool matches(arg) {
269 return arg is CompilationUnit && arg.element.source.fullName == file; 271 return arg is CompilationUnit && arg.element.source.fullName == file;
270 } 272 }
271 } 273 }
272 274
273 class _MockIndex extends TypedMock implements Index { 275 class _MockIndex extends TypedMock implements Index {}
274 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
275 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analysis_server/test/mocks.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698