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

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

Issue 790363006: Upgrade unittest to be able to use isNotEmpty. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 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 | Annotate | Revision Log
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.domain.analysis; 5 library test.domain.analysis;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:analysis_server/src/analysis_server.dart'; 9 import 'package:analysis_server/src/analysis_server.dart';
10 import 'package:analysis_server/src/constants.dart'; 10 import 'package:analysis_server/src/constants.dart';
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 void test_setSubscriptions() { 172 void test_setSubscriptions() {
173 test('before analysis', () { 173 test('before analysis', () {
174 AnalysisTestHelper helper = new AnalysisTestHelper(); 174 AnalysisTestHelper helper = new AnalysisTestHelper();
175 // subscribe 175 // subscribe
176 helper.addAnalysisSubscriptionHighlights(helper.testFile); 176 helper.addAnalysisSubscriptionHighlights(helper.testFile);
177 // create project 177 // create project
178 helper.createSingleFileProject('int V = 42;'); 178 helper.createSingleFileProject('int V = 42;');
179 // wait, there are highlight regions 179 // wait, there are highlight regions
180 helper.waitForOperationsFinished().then((_) { 180 helper.waitForOperationsFinished().then((_) {
181 var highlights = helper.getHighlights(helper.testFile); 181 var highlights = helper.getHighlights(helper.testFile);
182 expect(highlights, isNot(isEmpty)); 182 expect(highlights, isNotEmpty);
183 }); 183 });
184 }); 184 });
185 185
186 test('after analysis', () { 186 test('after analysis', () {
187 AnalysisTestHelper helper = new AnalysisTestHelper(); 187 AnalysisTestHelper helper = new AnalysisTestHelper();
188 // create project 188 // create project
189 helper.createSingleFileProject('int V = 42;'); 189 helper.createSingleFileProject('int V = 42;');
190 // wait, no regions initially 190 // wait, no regions initially
191 return helper.waitForOperationsFinished().then((_) { 191 return helper.waitForOperationsFinished().then((_) {
192 var highlights = helper.getHighlights(helper.testFile); 192 var highlights = helper.getHighlights(helper.testFile);
193 expect(highlights, isEmpty); 193 expect(highlights, isEmpty);
194 // subscribe 194 // subscribe
195 helper.addAnalysisSubscriptionHighlights(helper.testFile); 195 helper.addAnalysisSubscriptionHighlights(helper.testFile);
196 // wait, has regions 196 // wait, has regions
197 return helper.waitForOperationsFinished().then((_) { 197 return helper.waitForOperationsFinished().then((_) {
198 var highlights = helper.getHighlights(helper.testFile); 198 var highlights = helper.getHighlights(helper.testFile);
199 expect(highlights, isNot(isEmpty)); 199 expect(highlights, isNotEmpty);
200 }); 200 });
201 }); 201 });
202 }); 202 });
203 203
204 test('after analysis, no such file', () { 204 test('after analysis, no such file', () {
205 AnalysisTestHelper helper = new AnalysisTestHelper(); 205 AnalysisTestHelper helper = new AnalysisTestHelper();
206 helper.createSingleFileProject('int V = 42;'); 206 helper.createSingleFileProject('int V = 42;');
207 return helper.waitForOperationsFinished().then((_) { 207 return helper.waitForOperationsFinished().then((_) {
208 String noFile = '/no-such-file.dart'; 208 String noFile = '/no-such-file.dart';
209 helper.addAnalysisSubscriptionHighlights(noFile); 209 helper.addAnalysisSubscriptionHighlights(noFile);
210 return helper.waitForOperationsFinished().then((_) { 210 return helper.waitForOperationsFinished().then((_) {
211 var highlights = helper.getHighlights(noFile); 211 var highlights = helper.getHighlights(noFile);
212 expect(highlights, isEmpty); 212 expect(highlights, isEmpty);
213 }); 213 });
214 }); 214 });
215 }); 215 });
216 216
217 test('after analysis, SDK file', () { 217 test('after analysis, SDK file', () {
218 AnalysisTestHelper helper = new AnalysisTestHelper(); 218 AnalysisTestHelper helper = new AnalysisTestHelper();
219 helper.createSingleFileProject(''' 219 helper.createSingleFileProject('''
220 main() { 220 main() {
221 print(42); 221 print(42);
222 } 222 }
223 '''); 223 ''');
224 return helper.waitForOperationsFinished().then((_) { 224 return helper.waitForOperationsFinished().then((_) {
225 String file = '/lib/core/core.dart'; 225 String file = '/lib/core/core.dart';
226 helper.addAnalysisSubscriptionNavigation(file); 226 helper.addAnalysisSubscriptionNavigation(file);
227 return helper.waitForOperationsFinished().then((_) { 227 return helper.waitForOperationsFinished().then((_) {
228 var navigationRegions = helper.getNavigation(file); 228 var navigationRegions = helper.getNavigation(file);
229 expect(navigationRegions, isNot(isEmpty)); 229 expect(navigationRegions, isNotEmpty);
230 }); 230 });
231 }); 231 });
232 }); 232 });
233 } 233 }
234 234
235 235
236 testUpdateContent() { 236 testUpdateContent() {
237 test('bad type', () { 237 test('bad type', () {
238 AnalysisTestHelper helper = new AnalysisTestHelper(); 238 AnalysisTestHelper helper = new AnalysisTestHelper();
239 helper.createSingleFileProject('// empty'); 239 helper.createSingleFileProject('// empty');
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 import 'package:pkgA/libA.dart'; 389 import 'package:pkgA/libA.dart';
390 f(A a) { 390 f(A a) {
391 } 391 }
392 '''); 392 ''');
393 String pkgDependency = posix.join(projectPath, 'package_dep'); 393 String pkgDependency = posix.join(projectPath, 'package_dep');
394 resourceProvider.newFile(pkgDependency, 'contents'); 394 resourceProvider.newFile(pkgDependency, 'contents');
395 packageMapProvider.dependencies.add(pkgDependency); 395 packageMapProvider.dependencies.add(pkgDependency);
396 // Create project and wait for analysis 396 // Create project and wait for analysis
397 createProject(); 397 createProject();
398 return waitForTasksFinished().then((_) { 398 return waitForTasksFinished().then((_) {
399 expect(filesErrors[testFile], isNot(isEmpty)); 399 expect(filesErrors[testFile], isNotEmpty);
400 // Add the package to the package map and tickle the package dependency. 400 // Add the package to the package map and tickle the package dependency.
401 packageMapProvider.packageMap = { 401 packageMapProvider.packageMap = {
402 'pkgA': [resourceProvider.getResource('/packages/pkgA')] 402 'pkgA': [resourceProvider.getResource('/packages/pkgA')]
403 }; 403 };
404 resourceProvider.modifyFile(pkgDependency, 'new contents'); 404 resourceProvider.modifyFile(pkgDependency, 'new contents');
405 // Let the server time to notice the file has changed, then let 405 // Let the server time to notice the file has changed, then let
406 // analysis omplete. There should now be no error. 406 // analysis omplete. There should now be no error.
407 return pumpEventQueue().then((_) => waitForTasksFinished()).then((_) { 407 return pumpEventQueue().then((_) => waitForTasksFinished()).then((_) {
408 expect(filesErrors[testFile], isEmpty); 408 expect(filesErrors[testFile], isEmpty);
409 }); 409 });
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
640 return waitForServerOperationsPerformed(server); 640 return waitForServerOperationsPerformed(server);
641 } 641 }
642 642
643 static String _getCodeString(code) { 643 static String _getCodeString(code) {
644 if (code is List<String>) { 644 if (code is List<String>) {
645 code = code.join('\n'); 645 code = code.join('\n');
646 } 646 }
647 return code as String; 647 return code as String;
648 } 648 }
649 } 649 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698